statement.go (981B)
1 package ini 2 3 // Statement is an empty AST mostly used for transitioning states. 4 func newStatement() AST { 5 return newAST(ASTKindStatement, AST{}) 6 } 7 8 // SectionStatement represents a section AST 9 func newSectionStatement(tok Token) AST { 10 return newASTWithRootToken(ASTKindSectionStatement, tok) 11 } 12 13 // ExprStatement represents a completed expression AST 14 func newExprStatement(ast AST) AST { 15 return newAST(ASTKindExprStatement, ast) 16 } 17 18 // CommentStatement represents a comment in the ini defintion. 19 // 20 // grammar: 21 // comment -> #comment' | ;comment' 22 // comment' -> epsilon | value 23 func newCommentStatement(tok Token) AST { 24 return newAST(ASTKindCommentStatement, newExpression(tok)) 25 } 26 27 // CompletedSectionStatement represents a completed section 28 func newCompletedSectionStatement(ast AST) AST { 29 return newAST(ASTKindCompletedSectionStatement, ast) 30 } 31 32 // SkipStatement is used to skip whole statements 33 func newSkipStatement(ast AST) AST { 34 return newAST(ASTKindSkipStatement, ast) 35 }