Skip to content

Instantly share code, notes, and snippets.

@jimsynz
Created February 28, 2012 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jimsynz/1935860 to your computer and use it in GitHub Desktop.
Save jimsynz/1935860 to your computer and use it in GitHub Desktop.
grammar
1.9.3-p0 :002 > Crimson::Parser.parse('nil')
Exception: Parse error: Expected one of -, 0, nil at line 1, column 4 (byte 4) after .
from /Users/jnh/Dev/Toys/CrimsonScript/lib/crimson/parser.rb:12:in `parse'
from (irb):2
from /Users/jnh/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
1.9.3-p0 :003 > Crimson::Parser.parse('0')
Exception: Parse error: Expected one of -, 0, nil at line 1, column 2 (byte 2) after .
from /Users/jnh/Dev/Toys/CrimsonScript/lib/crimson/parser.rb:12:in `parse'
from (irb):3
from /Users/jnh/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
1.9.3-p0 :004 > Crimson::Parser.parse('1')
Exception: Parse error: Expected one of -, 0, nil at line 1, column 2 (byte 2) after .
from /Users/jnh/Dev/Toys/CrimsonScript/lib/crimson/parser.rb:12:in `parse'
from (irb):4
from /Users/jnh/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
module Crimson
grammar Grammar
include Crimson::Literals
# Literals
rule literal
( decimal_integer_literal / nil_literal )* <Literal>
end
rule nil_literal
"nil" <NilLiteral>
end
rule decimal_integer_literal
'-'? [1-9] [0-9]* / '0' <IntegerLiteral>
end
rule space
' '*
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment