Hi, I need to do a little parser with Go, however I have not been able to find any option that allows the parser to ignore case. For Bison there is% option caseless, is there something similar for gocc?
/* Lexical part */
_digit : ‘0’-‘9’ ;
int64 : ‘1’-‘9’ {_digit} ;
while: ‘w’ ‘h’ ‘i’ ‘l’ ‘e’; // This could be like WhILe
!whitespace : ’ ’ | ‘\t’ | ‘\n’ | ‘\r’ ;
/* Syntax part */
<<
import(
“github.com/goccmack/gocc/example/calc/token”
“github.com/goccmack/gocc/example/calc/util”
)
Calc : Expr;
Expr :
Expr “+” Term << $0.(int64) + $2.(int64), nil >>
| Term
;
Term :
Term “*” Factor << $0.(int64) * $2.(int64), nil >>
| Factor
;
Factor :
“(” Expr “)” << $1, nil >>
| int64 << util.IntValue($0.(*token.Token).Lit) >>
;