New, more flexible, parser context datatype that includes and extends
the previous flags allowForest and allowVarRef. Added binary operator (work in progress). Better implementation of +=,-=,*=, and /= (new) operators.
This commit is contained in:
@@ -93,6 +93,15 @@ func (tk *Token) Error() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (tk *Token) ErrorText() (err string) {
|
||||
if tk.Sym == SymError {
|
||||
if msg, ok := tk.Value.(error); ok {
|
||||
err = msg.Error()
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tk *Token) Errors(msg string) (err error) {
|
||||
err = fmt.Errorf("[%d:%d] %v", tk.row, tk.col, msg)
|
||||
return
|
||||
@@ -108,6 +117,6 @@ func (tk *Token) ErrorExpectedGotString(symbol, got string) (err error) {
|
||||
}
|
||||
|
||||
func (tk *Token) ErrorExpectedGotStringWithPrefix(prefix, symbol, got string) (err error) {
|
||||
err = fmt.Errorf("[%d:%d] %s `%s`, got `%s`", tk.row, tk.col, prefix, symbol, got)
|
||||
err = fmt.Errorf("[%d:%d] %s %s, got `%s`", tk.row, tk.col, prefix, symbol, got)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user