mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Started to add special function to inline code (issue #6).
This commit is contained in:
@@ -45,7 +45,8 @@ var keywords = []string{
|
||||
"try",
|
||||
"catch",
|
||||
"exitwith",
|
||||
"waituntil"}
|
||||
"waituntil",
|
||||
"code"}
|
||||
|
||||
var whitespace = []byte{' ', '\n', '\t', '\r'}
|
||||
var identifier = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
|
||||
|
||||
@@ -77,6 +77,14 @@ func TestTokenizerIdentifier(t *testing.T) {
|
||||
compareTokens(t, &got, &want)
|
||||
}
|
||||
|
||||
func TestTokenizerInlineCode(t *testing.T) {
|
||||
got := getTokens(t, "test/tokenizer_code.asl")
|
||||
want := []string{"var", "x", "=", "code", "(", "\"var x = 5;\"", ")", ";"}
|
||||
|
||||
compareLength(t, &got, &want)
|
||||
compareTokens(t, &got, &want)
|
||||
}
|
||||
|
||||
func compareLength(t *testing.T, got *[]Token, want *[]string) {
|
||||
if len(*got) != len(*want) {
|
||||
t.Error("Length of tokens got and expected tokens not equal, was:")
|
||||
|
||||
Reference in New Issue
Block a user