Location now stores width instead of Error

This commit is contained in:
2022-08-12 13:43:09 -05:00
parent 050c956787
commit 7914f0df45
6 changed files with 11 additions and 12 deletions

View File

@@ -35,7 +35,7 @@ func (lexer *LexingOperation) tokenize () (err error) {
if err != nil || shebangCheck[index] != lexer.char {
err = file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
"not an arf file",
file.ErrorKindError)
return
@@ -119,7 +119,7 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
err = lexer.nextRune()
file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
"tab not used as indent",
file.ErrorKindWarn).Print()
return
@@ -272,7 +272,7 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
err = lexer.nextRune()
default:
err = file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
"unexpected symbol character " +
string(lexer.char),
file.ErrorKindError)
@@ -334,7 +334,7 @@ func (lexer *LexingOperation) nextRune () (err error) {
lexer.char, _, err = lexer.file.ReadRune()
if err != nil && err != io.EOF {
return file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
err.Error(), file.ErrorKindError)
}
return

View File

@@ -23,7 +23,7 @@ func (lexer *LexingOperation) tokenizeNumberBeginning (negative bool) (err error
number, fragment, isFloat, err = lexer.tokenizeNumber(8)
} else {
return file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
"unexpected character in number literal",
file.ErrorKindError)
}

View File

@@ -43,7 +43,7 @@ func (lexer *LexingOperation) tokenizeString (isRuneLiteral bool) (err error) {
if isRuneLiteral {
if len(got) > 1 {
err = file.NewError (
lexer.file.Location(), len(got) - 1,
lexer.file.Location(),
"excess data in rune literal",
file.ErrorKindError)
return
@@ -99,7 +99,7 @@ func (lexer *LexingOperation) getEscapeSequence () (result rune, err error) {
if len(number) < 3 {
err = file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
"octal escape sequence too short",
file.ErrorKindError)
return
@@ -133,7 +133,7 @@ func (lexer *LexingOperation) getEscapeSequence () (result rune, err error) {
if len(number) < want {
err = file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
"hex escape sequence too short ",
file.ErrorKindError)
return
@@ -143,7 +143,7 @@ func (lexer *LexingOperation) getEscapeSequence () (result rune, err error) {
result = rune(parsedNumber)
} else {
err = file.NewError (
lexer.file.Location(), 1,
lexer.file.Location(),
"unknown escape character " +
string(lexer.char), file.ErrorKindError)
return