File: expression.go

package info (click to toggle)
golang-github-aws-aws-sdk-go 1.49.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312,636 kB
  • sloc: makefile: 120
file content (24 lines) | stat: -rw-r--r-- 565 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ini

// newExpression will return an expression AST.
// Expr represents an expression
//
//	grammar:
//	expr -> string | number
func newExpression(tok Token) AST {
	return newASTWithRootToken(ASTKindExpr, tok)
}

func newEqualExpr(left AST, tok Token) AST {
	return newASTWithRootToken(ASTKindEqualExpr, tok, left)
}

// EqualExprKey will return a LHS value in the equal expr
func EqualExprKey(ast AST) string {
	children := ast.GetChildren()
	if len(children) == 0 || ast.Kind != ASTKindEqualExpr {
		return ""
	}

	return string(children[0].Root.Raw())
}