fix: modified to fix some of the test failures.

This commit is contained in:
James Wells 2023-05-18 18:04:20 -07:00
parent bdeaf2ec92
commit 8f77f2258c
Signed by: jwells
GPG key ID: 73196D10B8E65666
7 changed files with 8 additions and 8 deletions

View file

@ -25,7 +25,7 @@ type parserStruct struct {
}
// initParser initializes a new parserStruct instance
func initParser(text string) *parserStruct {
func InitParser(text string) *parserStruct {
return &parserStruct{text: text, ln: len(text), Type: ParserTokenEOL}
}

View file

@ -66,7 +66,7 @@ func TestParser(t *testing.T) {
parser := picol.InitParser(tc.input)
for _, expectedType := range tc.expected {
token := parser.GetToken()
parser.GetToken()
if parser.Type != expectedType {
t.Errorf("Expected token type %d, got %d", expectedType, parser.Type)
}

View file

@ -116,7 +116,7 @@ func (interp *Interpreter) RegisterCommand(name string, fn CommandFunc, privdata
* Eval evaluates a script
*/
func (interp *Interpreter) Eval(script string) (string, error) {
parser := initParser(script)
parser := InitParser(script)
var result string
var err error