You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the manual:
import macros
macro case_token(n: stmt): stmt =
# creates a lexical analyzer from regular expressions
# ... (implementation is an exercise for the reader :-)
nil
case_token: # this colon tells the parser it is a macro statement
of r"[A-Za-z_]+[A-Za-z_0-9]*":
return tkIdentifier
of r"0-9+":
return tkInteger
of r"[\+\-\*\?]+":
return tkOperator
else:
return tkUnknown
Doesn't parse with:
Hint: used config file '/Users/eric/Documents/Private/Code/nimrod/Compiler/Nimrod/config/nimrod.cfg' [Conf]
Hint: system [Processing]
Hint: test [Processing]
Hint: macros [Processing]
Error: test.nim(8): expression expected, but found '[same indentation]'
The text was updated successfully, but these errors were encountered:
From the manual:
import macros
macro case_token(n: stmt): stmt =
# creates a lexical analyzer from regular expressions
# ... (implementation is an exercise for the reader :-)
nil
Doesn't parse with:
Hint: used config file '/Users/eric/Documents/Private/Code/nimrod/Compiler/Nimrod/config/nimrod.cfg' [Conf]
Hint: system [Processing]
Hint: test [Processing]
Hint: macros [Processing]
Error: test.nim(8): expression expected, but found '[same indentation]'
The text was updated successfully, but these errors were encountered: