func TestParseEox(test *testing.T) { const input = ` ` parser := NewParserForText(input) Assert(test, parser.ParseEOX(), "Could not parse EOX") tree.Display(parser.Ast) }
func TestParseProgram(test *testing.T) { const input = `val + 10 * z. open door. ` parser := NewParserForText(input) Assert(test, parser.ParseProgram(), "Could not parse program.") tree.Display(parser.Ast) }
func TestParseStatements(test *testing.T) { const input = `val + 10 * z. open door. ` parser := NewParserForText(input) Assert(test, parser.ParseStatements(), "Could not parse statements with only a parse word expression with operators") tree.Display(parser.Ast) }
func TestParseWordExpression2(test *testing.T) { const input = `val + 10 * z ` parser := NewParserForText(input) Assert(test, parser.ParseWordExpression(), "Could not parse word expression with operators") tree.Display(parser.Ast) }
func TestParseWordExpression(test *testing.T) { const input = `say "hello world" three times ` parser := NewParserForText(input) Assert(test, parser.ParseWordExpression(), "Could not parse word expression") tree.Display(parser.Ast) }
func TestParseParenthesis(test *testing.T) { // monolog.Setup("raku_test.log", true, false) const input = `(3 + 4 * 5)` parser := NewParserForText(input) Assert(test, parser.ParseParenthesis(), "Could not parse parenthesis.") tree.Display(parser.Ast) parser.Ast.Dotty() }
func TestParseProgram3(test *testing.T) { // monolog.Setup("raku_test.log", true, false) const input = `set foo to (3 + 4) ` parser := NewParserForText(input) Assert(test, parser.ParseProgram(), "Could not parse program.") tree.Display(parser.Ast) parser.Ast.Dotty() }
func TestParseblock(test *testing.T) { // monolog.Setup("raku_test.log", true, false) const input = `{ say "hello" say "world" let i be 3 + 4 let j be 7 + 5 let ij be i * j return ij } ` parser := NewParserForText(input) Assert(test, parser.ParseBlock(), "Could not parse block.") tree.Display(parser.Ast) // parser.Ast.Dotty() }
func TestParseProgram2(test *testing.T) { const input = `to greet someone { say "hello" someone } greet bob if mp < cost do say "Not enough mana!" end else do say "Zap!" end ` parser := NewParserForText(input) Assert(test, parser.ParseProgram(), "Could not parse program.") tree.Display(parser.Ast) }
func TestParseValue3(test *testing.T) { const input = `$sym` parser := NewParserForText(input) Assert(test, parser.ParseValue(), "Could not parse value") tree.Display(parser.Ast) }
func TestParseValue(test *testing.T) { const input = `"hello \"world\\"` parser := NewParserForText(input) Assert(test, parser.ParseValue(), "Could not parse value") tree.Display(parser.Ast) }
func TestParseWord(test *testing.T) { const input = `say` parser := NewParserForText(input) Assert(test, parser.ParseWord(), "Could not parse word") tree.Display(parser.Ast) }