Implemented invalid character checks
This commit is contained in:
parent
8362d0a91a
commit
0553706891
7 changed files with 36 additions and 0 deletions
|
@ -119,6 +119,10 @@ func scanFile(path string, functions chan<- *Function) error {
|
|||
continue
|
||||
}
|
||||
|
||||
if tokens[i].Kind == token.Invalid {
|
||||
return errors.New(&errors.InvalidCharacter{Character: tokens[i].Text()}, file, tokens[i].Position)
|
||||
}
|
||||
|
||||
if tokens[i].Kind == token.EOF {
|
||||
return nil
|
||||
}
|
||||
|
@ -156,6 +160,10 @@ func scanFile(path string, functions chan<- *Function) error {
|
|||
continue
|
||||
}
|
||||
|
||||
if tokens[i].Kind == token.Invalid {
|
||||
return errors.New(&errors.InvalidCharacter{Character: tokens[i].Text()}, file, tokens[i].Position)
|
||||
}
|
||||
|
||||
if tokens[i].Kind == token.EOF {
|
||||
if groupLevel > 0 {
|
||||
return errors.New(errors.MissingGroupEnd, file, tokens[i].Position)
|
||||
|
@ -204,6 +212,10 @@ func scanFile(path string, functions chan<- *Function) error {
|
|||
continue
|
||||
}
|
||||
|
||||
if tokens[i].Kind == token.Invalid {
|
||||
return errors.New(&errors.InvalidCharacter{Character: tokens[i].Text()}, file, tokens[i].Position)
|
||||
}
|
||||
|
||||
if tokens[i].Kind == token.EOF {
|
||||
if blockLevel > 0 {
|
||||
return errors.New(errors.MissingBlockEnd, file, tokens[i].Position)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue