How specify that whitespace should not count?

Skip to first unread message

Anders Eriksson

Dec 9, 2014, 6:50:18 PM12/9/14
I am doing my first try with GOLD and I'm trying to parse abc music notation.
The grammar has been accepted but when I try to test it with an data file I get an error when the parser finds a space.

In the data file I have this line
X: 1

The grammar for this looks like this (This is just a snippet of the grammar file)
Whitespace    = {WS}+
NewLine       = {CR}{LF} | {CR} | {LF}
StringLiteral = '"' {String Chars}* '"'

Digits        = {digit}+
<comment> ::= '%' StringLiteral NewLine
<end-of-line> ::= <comment> | NewLine 
<field-number> ::= 'X:' Digits <end-of-line>

The test log
   Result      : Syntax Error
   Column      : 2
   Line        : 0
   Parse Value : {space}
   Description : Expecting one of the following tokens: Digits

How do I make the parser to ignore whitespace between tokens?

// Anders

Dave Dolan

Dec 18, 2014, 10:55:01 PM12/18/14
Since it's just a snippet, I can only speak to the bits I can see. Don't define a white space terminal. Then white space won't be recognized as a token, and spaces will be ignored. It's the default behavior.


You received this message because you are subscribed to the Google Groups "GOLD Parsing System" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Dave Dolan
Reply all
Reply to author
0 new messages