diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-07-12 01:19:38 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-07-12 01:19:38 +0200 |
commit | a1da1232783068149313dd0a1fdb353894bca07e (patch) | |
tree | bf9fa392cf1e728bf84faf0461a5fd1f83f9134b /src/config.l | |
parent | 96d8f1a90009cceb08d05478b15a20e51d1275e7 (diff) | |
download | fastd-a1da1232783068149313dd0a1fdb353894bca07e.tar fastd-a1da1232783068149313dd0a1fdb353894bca07e.zip |
scanner: ignore \r in config files
Diffstat (limited to 'src/config.l')
-rw-r--r-- | src/config.l | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/config.l b/src/config.l index 1837185..6ba2fa1 100644 --- a/src/config.l +++ b/src/config.l @@ -83,7 +83,7 @@ verify { TOKEN(TOK_VERIFY); } peers { TOKEN(TOK_PEERS); } from { TOKEN(TOK_FROM); } log { TOKEN(TOK_LOG); } -level { TOKEN(TOK_LEVEL); } +level { TOKEN(TOK_LEVEL); } syslog { TOKEN(TOK_SYSLOG); } stderr { TOKEN(TOK_STDERR); } to { TOKEN(TOK_TO); } @@ -127,6 +127,7 @@ addresses { TOKEN(TOK_ADDRESSES); } [ \t] { yylloc->last_column++; } \n { yylloc->last_column = 0; yylloc->last_line++; } +\r ; } <NEEDSPACE>{ @@ -134,11 +135,13 @@ addresses { TOKEN(TOK_ADDRESSES); } [ \t] { yylloc->last_column++; BEGIN(INITIAL); } \n { yylloc->last_column = 0; yylloc->last_line++; BEGIN(INITIAL); } +\r ; } <INITIAL>\" { UPDATE_LOCATION; BEGIN(STRING); } -<STRING>[^"\\\n] { yylloc->last_column++; yymore(); } +<STRING>[^"\\\n\r] { yylloc->last_column++; yymore(); } <STRING>\n { yylloc->last_line++; yylloc->last_column = 0; yymore(); } +<STRING>\r { yymore(); } <STRING>\\. { yylloc->last_column+=2; yymore(); } <STRING>\\\n { yylloc->last_line++; yylloc->last_column = 0; yymore(); } <STRING>\" { @@ -182,8 +185,9 @@ addresses { TOKEN(TOK_ADDRESSES); } <INITIAL,NEEDSPACE>\/\* { UPDATE_LOCATION; BEGIN(COMMENT); } <COMMENT>\*\/ { yylloc->last_column += yyleng; BEGIN(INITIAL); } -<COMMENT>. { yylloc->last_column++; } +<COMMENT>[^\n\r] { yylloc->last_column++; } <COMMENT>\n { yylloc->last_line++; yylloc->last_column = 0; } +<COMMENT>\r {} . { yylloc->first_line = yylloc->last_line; |