Created
March 29, 2013 14:01
-
-
Save andydude/5271051 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is at C/CIntent.pm6 | |
grammar C::CIdent; | |
token TOP {^ <ident> $} | |
# identifier | |
token ident { <.ident-first> <.ident-rest>* } | |
# identifier-nondigit | |
proto token ident-first {*} | |
token ident-first:sym<under> { '_' } | |
token ident-first:sym<alpha> { <.alpha> } | |
# identifier-nondigit | digit | |
proto token ident-rest {*} | |
token ident-rest:sym<alpha> { <.ident-first> } | |
token ident-rest:sym<digit> { <.digit> } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPECTED | |
$ niecza C/CTest.pl6 'test' | |
「test」 | |
ident => 「test」 | |
GOT | |
$ niecza C/CTest.pl6 'test' | |
Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object | |
at Niecza.Frame.MakeChild (Niecza.Frame outer, Niecza.SubInfo info, Niecza.P6any sub) [0x00000] in <filename unknown>:0 | |
at Niecza.SubInfo.SetupCall (Niecza.Frame caller, Niecza.Frame outer, Niecza.P6any sub, Niecza.Variable[] pos, Niecza.VarHash named, Boolean quiet, Niecza.DispatchEnt de) [0x00000] in <filename unknown>:0 | |
at Niecza.P6any.InvokeMethod (Niecza.Frame caller, System.String name, Niecza.Variable[] pos, Niecza.VarHash named) [0x00000] in <filename unknown>:0 | |
at C.CIdent.a86e899e-7a30-471a-a6f1-c3dbeba995f4.C3CIdent.ident (Niecza.Frame ) [0x00000] in <filename unknown>:0 | |
at Niecza.Kernel.RunCore (Niecza.Frame& cur) [0x00000] in <filename unknown>:0 | |
at /Users/ajr/db/local/src/c2drox/lib/C/CIdent.pm6 line 9 (CIdent.ident @ 3) | |
at /Users/ajr/db/local/src/c2drox/lib/C/CIdent.pm6 line 6 (CIdent.TOP @ 3) | |
at /Users/ajr/db/local/src/niecza/lib/CORE.setting line 2990 (Grammar.parse @ 5) | |
at /Users/ajr/db/local/src/c2drox/lib/C/CTest.pl6 line 5 (mainline @ 6) | |
at /Users/ajr/db/local/src/niecza/lib/CORE.setting line 4299 (ANON @ 3) | |
at /Users/ajr/db/local/src/niecza/lib/CORE.setting line 4300 (module-CORE @ 583) | |
at /Users/ajr/db/local/src/niecza/lib/CORE.setting line 4300 (mainline @ 3) | |
at <unknown> line 0 (ExitRunloop @ 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use C::CIdent; | |
my $source = @*ARGS[0]; | |
say C::CIdent.parse($source); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment