Closed vzarytovskii closed 1 year ago
a simpler example:
let main _ =
for i in is do
ignore i
to add to this. a bare for or while loop will error
while true do
()
Output
(ERROR [0, 0] - [2, 0]
(ERROR [0, 11] - [0, 13])) ; this is the `do`
Debug log
new_parse
process version:0, version_count:1, state:1, row:0, col:0
lex_internal state:889, row:0, column:0
consume character:'w'
consume character:'h'
lex_external state:1, row:0, column:0
lex_internal state:0, row:0, column:0
consume character:'w'
consume character:'h'
consume character:'i'
consume character:'l'
consume character:'e'
lexed_lookahead sym:while, size:5
detect_error
resume version:0
skip_token symbol:while
process version:0, version_count:1, state:0, row:0, col:5
lex_external state:1, row:0, column:5
lex_internal state:0, row:0, column:5
skip character:' '
consume character:'t'
consume character:'r'
consume character:'u'
consume character:'e'
lexed_lookahead sym:true, size:5
skip_token symbol:true
process version:0, version_count:1, state:0, row:0, col:10
lex_external state:1, row:0, column:10
lex_internal state:0, row:0, column:10
skip character:' '
skip_unrecognized_character
consume character:'d'
lex_external state:1, row:0, column:12
lex_internal state:0, row:0, column:12
consume character:'o'
lex_external state:1, row:0, column:13
lex_internal state:0, row:0, column:13
skip character:10
skip character:' '
skip character:' '
skip character:' '
skip character:' '
consume character:'('
lexed_lookahead sym:ERROR, size:3
skip_token symbol:ERROR
process version:0, version_count:1, state:0, row:0, col:13
lex_external state:1, row:0, column:13
lex_internal state:0, row:0, column:13
skip character:10
skip character:' '
skip character:' '
skip character:' '
skip character:' '
consume character:'('
lexed_lookahead sym:(, size:6
skip_token symbol:(
process version:0, version_count:1, state:0, row:1, col:5
lex_external state:1, row:1, column:5
lex_internal state:0, row:1, column:5
consume character:')'
lexed_lookahead sym:), size:1
skip_token symbol:)
process version:0, version_count:1, state:0, row:1, col:6
lex_external state:1, row:1, column:6
lex_internal state:0, row:1, column:6
skip character:10
lexed_lookahead sym:end, size:1
recover_eof
done
I'll have a jab at fixing this one.
@Eliemer the grammar does not allow for top level expressions, but your example should work if you wrap it in a let or do expression
This issue is compounded of two things: 1) for expressions failed to parse in any form 2) The particular body of this for expression also fails to parse in isolation.
I'll continue the issue of 2 in #19
Two issues actually, the following expression:
will be parsed into:
Notice that it was parsed into bunch of identifiers, patters and
do_expression
, in this casefor_expression
should take priority. Second issue is thatexpressions
inside the, after the condition resulting in multiple errors (pointing tosomeDictionary.Add
).