Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

end of line ($) doesn't work as expected #4

Open
husio-org opened this issue Aug 2, 2013 · 2 comments
Open

end of line ($) doesn't work as expected #4

husio-org opened this issue Aug 2, 2013 · 2 comments

Comments

@husio-org
Copy link

just tried to use jison, and this got me lost for hours.

$ doesn't seem to work.

jison documentation points to bison, where $ is widely used.

in the samples here the \n+ is been used instead.

@zaach
Copy link
Owner

zaach commented Aug 2, 2013

Could you provide a link to the bison docs and jison samples you're referring to? I may have totally missed this.

@husio-org
Copy link
Author

Yes of course:

From Jison's Lexical Analysis docs you can follow "pattern matchers" into this URL:

http://dinosaur.compilertools.net/flex/flex_7.html#SEC7

And there you find:

`r$'
an r, but only at the end of a line (i.e., just before a newline). Equivalent to "r/\n".
Note that flex's notion of "newline" is exactly whatever the C compiler used to 
compile flex interprets '\n' as; in particular, on some DOS systems you must 
either filter out \r's in the input yourself, or explicitly use r/\r\n for "r$".

I was testing to write an HTTP parser where end of line is used to delimiter headers, etc. ^ and $ are very convenient in those cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants