diff --git a/pkg/shsh/.parsers.go.swp b/pkg/shsh/.parsers.go.swp index 38eb4f4..71ddc8d 100644 Binary files a/pkg/shsh/.parsers.go.swp and b/pkg/shsh/.parsers.go.swp differ diff --git a/pkg/shsh/parsers.go b/pkg/shsh/parsers.go index 7ba839f..b2b7129 100644 --- a/pkg/shsh/parsers.go +++ b/pkg/shsh/parsers.go @@ -21,11 +21,29 @@ const ( ) func Parse(arg *Token) { + switch arg.tag { + case LIST_T: + for i := arg; i; i = i.next { + Parse(i) + } + if list_is_operation(arg) { + arg.tag = OPERATION_T + } + + case OPERAND_T: + if string_is_operator(arg._inner) { + arg.tag = OPERATOR_T + } + + default: + ;// TODO: Tag a parse error? + } } func string_delimiters_valid(arg string) bool { - + // TODO: Enhance this function + go } func list_is_operation(arg *Token) bool { diff --git a/pkg/shsh/token.go b/pkg/shsh/token.go index 3617794..79cd1e6 100644 --- a/pkg/shsh/token.go +++ b/pkg/shsh/token.go @@ -32,11 +32,13 @@ func Lex(input string) Token { if is_list { // TODO: Pass a pointer out of Lex and store a pointer *iter._inner = Lex(tok.String()) + *iter.tag = LIST_T is_list = false } else { // TODO: Store a pointer to the contents of the stringbuilder *iter._inner = tok.String() + *iter.tag = OPERAND_T } iter_alloced = true