smalltalk: Clean up grammar and fix a bug with underscores in identifiers.

locals-and-roots
Doug Coleman 2016-03-30 08:49:28 -07:00
parent e49d721374
commit e4df1c8503
2 changed files with 4 additions and 2 deletions
extra/smalltalk/parser

View File

@ -298,3 +298,5 @@ test = <foreign parse-smalltalk LocalVariableDeclarationList>
{ } [ "class Foo []. Tests blah " parse-smalltalk drop ] unit-test
{ } [ "vocab:smalltalk/parser/test.st" ascii file-contents parse-smalltalk drop ] unit-test
{ } [ "_abc_" parse-smalltalk drop ] unit-test

View File

@ -16,7 +16,7 @@ ERROR: bad-number str ;
EBNF: parse-smalltalk
Character = .
WhitespaceCharacter = (" " | "\t" | "\n" | "\r" )
WhitespaceCharacter = [ \t\n\r]
DecimalDigit = [0-9]
Letter = [A-Za-z]
@ -27,7 +27,7 @@ OptionalWhiteSpace = (WhitespaceCharacter | Comment)*
Whitespace = (WhitespaceCharacter | Comment)+
LetterOrDigit = DecimalDigit | Letter
Identifier = (Letter | "_"):h (LetterOrDigit | "_")*:t => [[ { h t } flatten >string ]]
Identifier = (Letter | [_]):h (LetterOrDigit | [_])*:t => [[ { h t } flatten >string ]]
Reference = Identifier => [[ ast-name boa ]]
ConstantReference = "nil" => [[ nil ]]