• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang ast.NewVariable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/stephens2424/php/ast.NewVariable函数的典型用法代码示例。如果您正苦于以下问题:Golang NewVariable函数的具体用法?Golang NewVariable怎么用?Golang NewVariable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewVariable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestProperty

func TestProperty(t *testing.T) {
	testStr := `<?
  $res = $var->go;
  $var->go = $res;`
	p := NewParser(testStr)
	p.Debug = true
	p.MaxErrors = 0
	a, _ := p.Parse()
	if len(a) != 2 {
		t.Fatalf("Property did not correctly parse")
	}
	tree := ast.ExpressionStmt{ast.AssignmentExpression{
		Assignee: ast.NewVariable("res"),
		Operator: "=",
		Value: &ast.PropertyExpression{
			Receiver: ast.NewVariable("var"),
			Name:     ast.Identifier{Value: "go"},
		},
	}}
	if !assertEquals(a[0], tree) {
		t.Fatalf("Property did not correctly parse")
	}

	tree = ast.ExpressionStmt{ast.AssignmentExpression{
		Assignee: &ast.PropertyExpression{
			Receiver: ast.NewVariable("var"),
			Name:     ast.Identifier{Value: "go"},
		},
		Operator: "=",
		Value:    ast.NewVariable("res"),
	}}
	if !assertEquals(a[1], tree) {
		t.Fatalf("Property did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:35,代码来源:parser_test.go


示例2: TestForeachLoop

func TestForeachLoop(t *testing.T) {
	testStr := `<?
  foreach ($arr as $key => $val) {
    echo $key . $val;
  } ?>`
	p := NewParser()
	p.disableScoping = true
	a, _ := p.Parse("test.php", testStr)
	if len(a.Nodes) == 0 {
		t.Fatalf("While loop did not correctly parse")
	}
	tree := &ast.ForeachStmt{
		Source: ast.NewVariable("arr"),
		Key:    ast.NewVariable("key"),
		Value:  ast.NewVariable("val"),
		LoopBlock: &ast.Block{
			Statements: []ast.Statement{ast.Echo(ast.BinaryExpr{
				Operator:   ".",
				Antecedent: ast.NewVariable("key"),
				Subsequent: ast.NewVariable("val"),
				Type:       ast.String,
			})},
		},
	}
	if !assertEquals(a.Nodes[0], tree) {
		t.Fatalf("Foreach did not correctly parse")
	}
}
开发者ID:henrylee2cn,项目名称:php,代码行数:28,代码来源:parser_test.go


示例3: TestWhileLoopWithAssignment

func TestWhileLoopWithAssignment(t *testing.T) {
	testStr := `<?
  while ($var = mysql_assoc()) {
    echo $var;
  }`
	p := NewParser(testStr)
	p.Debug = true
	p.MaxErrors = 0
	a, _ := p.Parse()
	if len(a) == 0 {
		t.Fatalf("While loop did not correctly parse")
	}
	tree := &ast.WhileStmt{
		Termination: ast.AssignmentExpression{
			Assignee: ast.NewVariable("var"),
			Value: &ast.FunctionCallExpression{
				FunctionName: ast.Identifier{Value: "mysql_assoc"},
				Arguments:    make([]ast.Expression, 0),
			},
			Operator: "=",
		},
		LoopBlock: &ast.Block{
			Statements: []ast.Statement{
				ast.Echo(ast.NewVariable("var")),
			},
		},
	}
	if !assertEquals(a[0], tree) {
		t.Fatalf("While loop with assignment did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:31,代码来源:parser_test.go


示例4: TestForeachLoop

func TestForeachLoop(t *testing.T) {
	testStr := `<?
  foreach ($arr as $key => $val) {
    echo $key . $val;
  } ?>`
	p := NewParser(testStr)
	a, _ := p.Parse()
	if len(a) == 0 {
		t.Fatalf("While loop did not correctly parse")
	}
	tree := &ast.ForeachStmt{
		Source: ast.NewVariable("arr"),
		Key:    ast.NewVariable("key"),
		Value:  ast.NewVariable("val"),
		LoopBlock: &ast.Block{
			Statements: []ast.Statement{ast.Echo(ast.OperatorExpression{
				Operator: ".",
				Operand1: ast.NewVariable("key"),
				Operand2: ast.NewVariable("val"),
				Type:     ast.String,
			})},
		},
	}
	if !assertEquals(a[0], tree) {
		t.Fatalf("Foreach did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:27,代码来源:parser_test.go


示例5: parseForeach

func (p *Parser) parseForeach() ast.Statement {
	stmt := &ast.ForeachStmt{}
	p.expect(token.OpenParen)
	stmt.Source = p.parseNextExpression()
	p.expect(token.AsOperator)
	if p.peek().typ == token.AmpersandOperator {
		p.expect(token.AmpersandOperator)
	}
	p.expect(token.VariableOperator)
	p.next()
	first := ast.NewVariable(p.current.val)
	if p.peek().typ == token.ArrayKeyOperator {
		stmt.Key = first
		p.expect(token.ArrayKeyOperator)
		if p.peek().typ == token.AmpersandOperator {
			p.expect(token.AmpersandOperator)
		}
		p.expect(token.VariableOperator)
		p.next()
		stmt.Value = ast.NewVariable(p.current.val)
	} else {
		stmt.Value = first
	}
	p.expect(token.CloseParen)
	p.next()
	stmt.LoopBlock = p.parseControlBlock(token.EndForeach)
	return stmt
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:28,代码来源:controlstructures.go


示例6: TestInstantiation

func TestInstantiation(t *testing.T) {
	testStr := `<?
  $obj = new Obj::$classes['obj']($arg);`
	p := NewParser(testStr)
	a, errs := p.Parse()
	if len(errs) != 0 {
		t.Fatalf("Did not parse instantiation correctly: %s", errs)
	}
	tree := ast.ExpressionStmt{ast.AssignmentExpression{
		Operator: "=",
		Assignee: ast.NewVariable("obj"),
		Value: &ast.NewExpression{
			Class: ast.NewClassExpression("Obj", &ast.ArrayLookupExpression{
				Array: ast.NewVariable("classes"),
				Index: &ast.Literal{Type: ast.String, Value: `'obj'`},
			}),
			Arguments: []ast.Expression{
				ast.NewVariable("arg"),
			},
		},
	}}
	if !assertEquals(a[0], tree) {
		t.Fatalf("Instantiation did not parse correctly")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:25,代码来源:oop_test.go


示例7: TestMethodCall

func TestMethodCall(t *testing.T) {
	testStr := `<?
  $res = $var->go();`
	p := NewParser(testStr)
	p.Debug = true
	p.MaxErrors = 0
	a, _ := p.Parse()
	if len(a) == 0 {
		t.Fatalf("Method call did not correctly parse")
	}
	tree := ast.ExpressionStmt{ast.AssignmentExpression{
		Assignee: ast.NewVariable("res"),
		Operator: "=",
		Value: &ast.MethodCallExpression{
			Receiver: ast.NewVariable("var"),
			FunctionCallExpression: &ast.FunctionCallExpression{
				FunctionName: ast.Identifier{Value: "go"},
				Arguments:    make([]ast.Expression, 0),
			},
		},
	}}
	if !assertEquals(a[0], tree) {
		t.Fatalf("Method call did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:25,代码来源:parser_test.go


示例8: TestList

func TestList(t *testing.T) {
	testStr := `<?
    list($one, $two) = array(1, 2);`

	p := NewParser()
	a, err := p.Parse("test.php", testStr)
	if err != nil {
		t.Fatalf("Did not parse list correctly: %s", err)
	}

	tree := ast.ExpressionStmt{&ast.ListStatement{
		Operator: "=",
		Assignees: []ast.Assignable{
			ast.NewVariable("one"),
			ast.NewVariable("two"),
		},
		Value: &ast.ArrayExpression{
			Pairs: []ast.ArrayPair{
				{Key: nil, Value: &ast.Literal{Value: "1", Type: ast.Float}},
				{Key: nil, Value: &ast.Literal{Value: "2", Type: ast.Float}},
			},
		},
	}}

	if !assertEquals(a.Nodes[0], tree) {
		t.Fatalf("Array bracked did not parse correctly")
	}
}
开发者ID:xingskycn,项目名称:php-1,代码行数:28,代码来源:array_test.go


示例9: TestGlobal

func TestGlobal(t *testing.T) {
	testStr := `<?
  global $var, $otherVar;`
	p := NewParser(testStr)
	a, _ := p.Parse()
	tree := &ast.GlobalDeclaration{
		Identifiers: []*ast.Variable{
			ast.NewVariable("var"),
			ast.NewVariable("otherVar"),
		},
	}
	if !assertEquals(a[0], tree) {
		t.Fatalf("Global did not parse correctly")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:15,代码来源:parser_test.go


示例10: TestArray

func TestArray(t *testing.T) {
	testStr := `<?
  $var = array("one", "two", "three");`
	p := NewParser(testStr)
	p.Debug = true
	a, _ := p.Parse()
	if len(a) == 0 {
		t.Fatalf("Array did not correctly parse")
	}
	tree := ast.ExpressionStmt{
		ast.AssignmentExpression{
			Assignee: ast.NewVariable("var"),
			Operator: "=",
			Value: &ast.ArrayExpression{
				ast.BaseNode{},
				ast.ArrayType{},
				[]ast.ArrayPair{
					{Value: &ast.Literal{Type: ast.String, Value: `"one"`}},
					{Value: &ast.Literal{Type: ast.String, Value: `"two"`}},
					{Value: &ast.Literal{Type: ast.String, Value: `"three"`}},
				},
			},
		},
	}
	if !reflect.DeepEqual(a[0], tree) {
		fmt.Printf("Found:    %+v\n", a[0])
		fmt.Printf("Expected: %+v\n", tree)
		t.Fatalf("Array did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:30,代码来源:parser_test.go


示例11: parseIdentifier

func (p *Parser) parseIdentifier() (expr ast.Expr) {
	switch typ := p.peek().Typ; {
	case typ == token.OpenParen && !p.instantiation:
		// Function calls are okay here because we know they came with
		// a non-dynamic identifier.
		expr = p.parseFunctionCall(&ast.Identifier{Value: p.current.Val})
		p.next()
	case typ == token.ScopeResolutionOperator:
		classIdent := p.current.Val
		p.next() // get onto ::, then we get to the next expr
		p.next()
		expr = ast.NewClassExpression(classIdent, p.parseOperand())
		p.next()
	case p.instantiation:
		defer p.next()
		return &ast.Identifier{Value: p.current.Val}
	default:
		name := p.current.Val
		v := ast.NewVariable(p.current.Val)
		expr = ast.ConstantExpr{
			Variable: v,
		}
		p.namespace.Constants[name] = append(p.namespace.Constants[name], v)
		p.next()
	}
	return expr
}
开发者ID:henrylee2cn,项目名称:php,代码行数:27,代码来源:expression.go


示例12: TestArrayKeys

func TestArrayKeys(t *testing.T) {
	testStr := `<?
  $var = array(1 => "one", 2 => "two", 3 => "three");`
	p := NewParser(testStr)
	a, _ := p.Parse()
	if len(a) == 0 {
		t.Fatalf("Array did not correctly parse")
	}
	tree := ast.ExpressionStmt{ast.AssignmentExpression{
		Assignee: ast.NewVariable("var"),
		Operator: "=",
		Value: &ast.ArrayExpression{
			ast.BaseNode{},
			ast.ArrayType{},
			[]ast.ArrayPair{
				{Key: &ast.Literal{Type: ast.Float, Value: "1"}, Value: &ast.Literal{Type: ast.String, Value: `"one"`}},
				{Key: &ast.Literal{Type: ast.Float, Value: "2"}, Value: &ast.Literal{Type: ast.String, Value: `"two"`}},
				{Key: &ast.Literal{Type: ast.Float, Value: "3"}, Value: &ast.Literal{Type: ast.String, Value: `"three"`}},
			},
		},
	}}
	if !assertEquals(a[0], tree) {
		t.Fatalf("Array did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:25,代码来源:parser_test.go


示例13: TestArrayBracket

func TestArrayBracket(t *testing.T) {
	testStr := `<?
    $arr = ["one", "two"];
    $arr2 = ["one" => 1, "two" => 2];`

	p := NewParser()
	a, err := p.Parse("test.php", testStr)
	if err != nil {
		t.Fatalf("Did not parse array bracket correctly: %s", err)
	}

	tree := []ast.Statement{
		ast.ExpressionStmt{ast.AssignmentExpression{
			Operator: "=",
			Assignee: ast.NewVariable("arr"),
			Value: &ast.ArrayExpression{
				Pairs: []ast.ArrayPair{
					{Key: nil, Value: &ast.Literal{Value: `"one"`, Type: ast.String}},
					{Key: nil, Value: &ast.Literal{Value: `"two"`, Type: ast.String}},
				},
			},
		}},
		ast.ExpressionStmt{ast.AssignmentExpression{
			Operator: "=",
			Assignee: ast.NewVariable("arr2"),
			Value: &ast.ArrayExpression{
				Pairs: []ast.ArrayPair{
					{
						Key:   &ast.Literal{Value: `"one"`, Type: ast.String},
						Value: &ast.Literal{Value: "1", Type: ast.Float},
					},
					{
						Key:   &ast.Literal{Value: `"two"`, Type: ast.String},
						Value: &ast.Literal{Value: "2", Type: ast.Float},
					},
				},
			},
		}},
	}

	if !assertEquals(a.Nodes[0], tree[0]) {
		t.Fatalf("Array bracked did not parse correctly")
	}
	if !assertEquals(a.Nodes[1], tree[1]) {
		t.Fatalf("Array bracked did not parse correctly")
	}
}
开发者ID:xingskycn,项目名称:php-1,代码行数:47,代码来源:array_test.go


示例14: TestFunction

func TestFunction(t *testing.T) {
	testStr := `<?php
    function TestFn($arg) {
      echo $arg;
    }
    $var = TestFn("world", 0);`
	p := NewParser()
	p.disableScoping = true
	a, _ := p.Parse("test.php", testStr)
	tree := []ast.Node{
		&ast.FunctionStmt{
			FunctionDefinition: &ast.FunctionDefinition{
				Name: "TestFn",
				Arguments: []*ast.FunctionArgument{
					{
						Variable: ast.NewVariable("arg"),
					},
				},
			},
			Body: &ast.Block{
				Statements: []ast.Statement{ast.Echo(ast.NewVariable("arg"))},
			},
		},
		ast.ExprStmt{
			ast.AssignmentExpr{
				Assignee: ast.NewVariable("var"),
				Value: &ast.FunctionCallExpr{
					FunctionName: &ast.Identifier{Value: "TestFn"},
					Arguments: []ast.Expr{
						&ast.Literal{Type: ast.String, Value: `"world"`},
						&ast.Literal{Type: ast.Float, Value: "0"},
					},
				},
				Operator: "=",
			},
		},
	}
	if len(a.Nodes) != 2 {
		t.Fatalf("Function did not correctly parse")
	}
	if !assertEquals(a.Nodes[0], tree[0]) {
		t.Fatalf("Function did not correctly parse")
	}
	if !assertEquals(a.Nodes[1], tree[1]) {
		t.Fatalf("Function assignment did not correctly parse")
	}
}
开发者ID:henrylee2cn,项目名称:php,代码行数:47,代码来源:parser_test.go


示例15: TestScopeResolutionOperator

func TestScopeResolutionOperator(t *testing.T) {
	testStr := `<?
  MyClass::myfunc($var);
  echo MyClass::myconst;
  echo $var::myfunc();`
	p := NewParser()
	p.disableScoping = true
	a, _ := p.Parse("test.php", testStr)
	tree := []ast.Node{
		ast.ExprStmt{
			&ast.ClassExpr{
				Receiver: &ast.Identifier{Value: "MyClass"},
				Expr: &ast.FunctionCallExpr{
					FunctionName: &ast.Identifier{Value: "myfunc"},
					Arguments: []ast.Expr{
						ast.NewVariable("var"),
					},
				},
			},
		},
		ast.Echo(&ast.ClassExpr{
			Receiver: &ast.Identifier{Value: "MyClass"},
			Expr: ast.ConstantExpr{
				ast.NewVariable("myconst"),
			},
		}),
		ast.Echo(&ast.ClassExpr{
			Receiver: ast.NewVariable("var"),
			Expr: &ast.FunctionCallExpr{
				FunctionName: &ast.Identifier{Value: "myfunc"},
				Arguments:    []ast.Expr{},
			},
		}),
	}
	if !assertEquals(a.Nodes[0], tree[0]) {
		t.Fatalf("Scope resolution operator function call did not correctly parse")
	}
	if !assertEquals(a.Nodes[1], tree[1]) {
		t.Fatalf("Scope resolution operator expression did not correctly parse")
	}
	if !assertEquals(a.Nodes[2], tree[2]) {
		t.Fatalf("Scope resolution operator function call on identifier did not correctly parse")
	}
}
开发者ID:henrylee2cn,项目名称:php,代码行数:44,代码来源:parser_test.go


示例16: TestArrayLookup

func TestArrayLookup(t *testing.T) {
	testStr := `<?
  echo $arr['one'][$two];
  $var->arr[] = 2;
  echo $arr[2 + 1];`
	p := NewParser()
	p.disableScoping = true
	p.Debug = true
	p.MaxErrors = 0
	a, _ := p.Parse("test.php", testStr)
	if len(a.Nodes) == 0 {
		t.Fatalf("Array lookup did not correctly parse")
	}
	tree := []ast.Node{
		ast.EchoStmt{
			Expressions: []ast.Expr{&ast.ArrayLookupExpr{
				Array: &ast.ArrayLookupExpr{
					Array: ast.NewVariable("arr"),
					Index: &ast.Literal{Type: ast.String, Value: `'one'`},
				},
				Index: ast.NewVariable("two"),
			}},
		},
		ast.ExprStmt{
			ast.AssignmentExpr{
				Assignee: ast.ArrayAppendExpr{
					Array: &ast.PropertyCallExpr{
						Receiver: ast.NewVariable("var"),
						Name:     &ast.Identifier{Value: "arr"},
					},
				},
				Operator: "=",
				Value:    &ast.Literal{Type: ast.Float, Value: "2"},
			},
		},
	}
	if !assertEquals(a.Nodes[0], tree[0]) {
		t.Fatalf("Array lookup did not correctly parse")
	}
	if !assertEquals(a.Nodes[1], tree[1]) {
		t.Fatalf("Array append expression did not correctly parse")
	}
}
开发者ID:henrylee2cn,项目名称:php,代码行数:43,代码来源:parser_test.go


示例17: TestForLoop

func TestForLoop(t *testing.T) {
	testStr := `<?
  for ($i = 0; $i < 10; $i++) {
    echo $i;
  }`
	p := NewParser()
	p.disableScoping = true
	p.Debug = true
	p.MaxErrors = 0
	a, _ := p.Parse("test.php", testStr)
	if len(a.Nodes) == 0 {
		t.Fatalf("For loop did not correctly parse")
	}
	tree := &ast.ForStmt{
		Initialization: []ast.Expr{ast.AssignmentExpr{
			Assignee: ast.NewVariable("i"),
			Value:    &ast.Literal{Type: ast.Float, Value: "0"},
			Operator: "=",
		}},
		Termination: []ast.Expr{ast.BinaryExpr{
			Antecedent: ast.NewVariable("i"),
			Subsequent: &ast.Literal{Type: ast.Float, Value: "10"},
			Operator:   "<",
			Type:       ast.Boolean,
		}},
		Iteration: []ast.Expr{ast.UnaryCallExpr{
			Operator:  "++",
			Operand:   ast.NewVariable("i"),
			Preceding: false,
		}},
		LoopBlock: &ast.Block{
			Statements: []ast.Statement{
				ast.Echo(ast.NewVariable("i")),
			},
		},
	}
	if !assertEquals(a.Nodes[0], tree) {
		t.Fatalf("For did not correctly parse")
	}
}
开发者ID:henrylee2cn,项目名称:php,代码行数:40,代码来源:parser_test.go


示例18: TestLiterals

func TestLiterals(t *testing.T) {
	testStr := `<?
  $var = "one";
  $var = 2;
  $var = true;
  $var = null;`
	p := NewParser()
	p.disableScoping = true
	a, _ := p.Parse("test.php", testStr)
	if len(a.Nodes) != 4 {
		t.Fatalf("Literals did not correctly parse")
	}
	tree := []ast.Node{
		ast.ExprStmt{ast.AssignmentExpr{
			Assignee: ast.NewVariable("var"),
			Value:    &ast.Literal{Type: ast.String, Value: `"one"`},
			Operator: "=",
		}},
		ast.ExprStmt{ast.AssignmentExpr{
			Assignee: ast.NewVariable("var"),
			Value:    &ast.Literal{Type: ast.Float, Value: "2"},
			Operator: "=",
		}},
		ast.ExprStmt{ast.AssignmentExpr{
			Assignee: ast.NewVariable("var"),
			Value:    &ast.Literal{Type: ast.Boolean, Value: "true"},
			Operator: "=",
		}},
		ast.ExprStmt{ast.AssignmentExpr{
			Assignee: ast.NewVariable("var"),
			Value:    &ast.Literal{Type: ast.Null, Value: "null"},
			Operator: "=",
		}},
	}
	if !reflect.DeepEqual(a.Nodes, tree) {
		fmt.Printf("Found:    %+v\n", a)
		fmt.Printf("Expected: %+v\n", tree)
		t.Fatalf("Literals did not correctly parse")
	}
}
开发者ID:henrylee2cn,项目名称:php,代码行数:40,代码来源:parser_test.go


示例19: TestForLoop

func TestForLoop(t *testing.T) {
	testStr := `<?
  for ($i = 0; $i < 10; $i++) {
    echo $i;
  }`
	p := NewParser(testStr)
	p.Debug = true
	p.MaxErrors = 0
	a, _ := p.Parse()
	if len(a) == 0 {
		t.Fatalf("For loop did not correctly parse")
	}
	tree := &ast.ForStmt{
		Initialization: []ast.Expression{ast.AssignmentExpression{
			Assignee: ast.NewVariable("i"),
			Value:    &ast.Literal{Type: ast.Float, Value: "0"},
			Operator: "=",
		}},
		Termination: []ast.Expression{ast.OperatorExpression{
			Operand1: ast.NewVariable("i"),
			Operand2: &ast.Literal{Type: ast.Float, Value: "10"},
			Operator: "<",
			Type:     ast.Boolean,
		}},
		Iteration: []ast.Expression{ast.OperatorExpression{
			Operator: "++",
			Operand1: ast.NewVariable("i"),
			Type:     ast.Numeric,
		}},
		LoopBlock: &ast.Block{
			Statements: []ast.Statement{
				ast.Echo(ast.NewVariable("i")),
			},
		},
	}
	if !assertEquals(a[0], tree) {
		t.Fatalf("For did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:39,代码来源:parser_test.go


示例20: TestWhileLoop

func TestWhileLoop(t *testing.T) {
	testStr := `<?
  while ($otherVar) {
    echo $var;
  }`
	p := NewParser(testStr)
	a, _ := p.Parse()
	if len(a) == 0 {
		t.Fatalf("While loop did not correctly parse")
	}
	tree := &ast.WhileStmt{
		Termination: ast.NewVariable("otherVar"),
		LoopBlock: &ast.Block{
			Statements: []ast.Statement{
				ast.Echo(ast.NewVariable("var")),
			},
		},
	}
	if !assertEquals(a[0], tree) {
		t.Fatalf("TestLoop did not correctly parse")
	}
}
开发者ID:BadIdeasMadeWorse,项目名称:php,代码行数:22,代码来源:parser_test.go



注:本文中的github.com/stephens2424/php/ast.NewVariable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang erx.NewError函数代码示例发布时间:2022-05-28
下一篇:
Golang ast.Echo函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap