wwall
2017-9-19 11:39:22

good day. question about lexer. how i must write code for lexer without return token. For example, in flex i can write

"//" {/* do nothing*/}

but in lexer for drracket

[(:seq #// #//) null]

return (position-token ’() (position 7 #f #f) (position 10 #f #f)) i don’t need any return from this token. Help me, please


jaz
2017-9-19 14:31:20

@wwall Assuming you’re using the lexer form from parser-tools/lex, you just want to call the lexer (tail-)recursively. That’s it. If you’re using a lexer-src-pos then you’d want to wrap your call in return-without-pos. The documentation for return-without-pos should be useful here: http://docs.racket-lang.org/parser-tools/Lexers.html?q=lexer-src-pos#%28form._%28%28lib._parser-tools%2Flex..rkt%29._return-without-pos%29%29


leif
2017-9-19 17:01:28

@mflatt Interesting, the example from yesterday (https://gist.github.com/LeifAndersen/ff07cb0ffd516b0333f2753db6e96c37) also causes it to crash on windows.


leif
2017-9-19 17:01:29

leif
2017-9-19 17:01:37

err….not crash


leif
2017-9-19 17:01:42

Cause it to jump to 42.


leif
2017-9-19 17:03:17

Oh wait, never mind. It is an os x bug


leif
2017-9-19 17:08:37

@mflatt O.O The behavior is different if I run it in DrRacket vs running it in the command line!


leif
2017-9-19 17:08:42

That is surprising.


leif
2017-9-19 17:13:42

(Also, it looks like the behavior goes back to Racket 5.2. It probably goes back even further although anything 5.1.x and older segfaults on startup.)