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

Special 'of' macro syntax doesn't parse #27

Closed
ddlsmurf opened this issue Mar 28, 2011 · 1 comment
Closed

Special 'of' macro syntax doesn't parse #27

ddlsmurf opened this issue Mar 28, 2011 · 1 comment

Comments

@ddlsmurf
Copy link
Contributor

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]'

@dom96
Copy link
Contributor

dom96 commented Apr 4, 2011

closed by 30565aa

@dom96 dom96 closed this as completed Apr 4, 2011
reactormonk pushed a commit to reactormonk/nim that referenced this issue Apr 25, 2011
reactormonk pushed a commit to reactormonk/nim that referenced this issue Apr 7, 2014
krux02 pushed a commit to krux02/Nim that referenced this issue Jan 11, 2022
27: Rework qualified lookup with nkerror r=saem a=saem



Co-authored-by: Saem Ghani <saemghani+github@gmail.com>
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