-
Notifications
You must be signed in to change notification settings - Fork 46
support off-side rule languages #5
Comments
since lookahead is supported in tokens, maybe this can be done with some magic tokens… I'll investigate on it. By the way, even if possible, it would mean one cannot skip |
after thinking about it, since |
maybe there is something that can be used from this paper: http://michaeldadams.org/papers/layout_parsing/LayoutParsing.pdf |
side note: here are the rules used by python's lexer to add INDENT and DEDENT tokens ( from http://docs.python.org/2/reference/lexical_analysis.html#indentation ):
it seems not too hard to implement, but the difficulty comes from the fact that this has to be mixed with user defined grammar If I find some time, I'll try to play with this Note: since we are parsing the stream as a single string (and not line by line), we have to include newline in our analysis, and take precedence over user defined tokens |
Closing because it's old :-). |
It seems
Hoa\Compiler
cannot parse Off-side rule languages.Maybe it could be sufficient to have the compiler adding automatically
INDENT
(respectivelyUNINDENT
) tokens each time indent increase (respectively decrease) by 1.The tricky part seems to be the matching between spaces, tab, and indent length…
The text was updated successfully, but these errors were encountered: