parser: implement initial tokeniser

only logging position, errors and non-whitespace elements

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-30 00:25:15 +00:00
parent 00fcde4c5b
commit 8aff8959d9
3 changed files with 82 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
package parser
import "asciigoat.org/core/lexer"
var (
// IsNewLine tells if a rune represents a line break or the start of one
IsNewLine = lexer.NewIsIn("\n\r")
// IsSpace tells if a rune is considered whitespace by unicode
IsSpace = lexer.IsSpace
// IsNotNewLine tells if a rune is anything other than line breaks
IsNotNewLine = lexer.NewIsNot(IsNewLine)
// IsNotSpace tells if a rune is anything other than whitespace
IsNotSpace = lexer.NewIsNot(IsSpace)
)