parser

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2018 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Overview

Package parser defines the full Serulian language parser and lexer for translating Serulian source code into an abstract syntax tree (AST).

Index

Constants

View Source
const EOFRUNE = -1

Variables

View Source
var BinaryOperators = []boe{

	boe{tokenTypeEllipsis, sourceshape.NodeDefineRangeExpression},
	boe{tokenTypeExclusiveEllipsis, sourceshape.NodeDefineExclusiveRangeExpression},

	boe{tokenTypeBooleanOr, sourceshape.NodeBooleanOrExpression},
	boe{tokenTypeBooleanAnd, sourceshape.NodeBooleanAndExpression},

	boe{tokenTypeEqualsEquals, sourceshape.NodeComparisonEqualsExpression},
	boe{tokenTypeNotEquals, sourceshape.NodeComparisonNotEqualsExpression},

	boe{tokenTypeLTE, sourceshape.NodeComparisonLTEExpression},
	boe{tokenTypeGTE, sourceshape.NodeComparisonGTEExpression},

	boe{tokenTypeLessThan, sourceshape.NodeComparisonLTExpression},
	boe{tokenTypeGreaterThan, sourceshape.NodeComparisonGTExpression},

	boe{tokenTypeNullOrValueOperator, sourceshape.NodeNullComparisonExpression},

	boe{tokenTypePipe, sourceshape.NodeBitwiseOrExpression},
	boe{tokenTypeAnd, sourceshape.NodeBitwiseAndExpression},
	boe{tokenTypeXor, sourceshape.NodeBitwiseXorExpression},
	boe{tokenTypeBitwiseShiftLeft, sourceshape.NodeBitwiseShiftLeftExpression},

	boe{tokenTypePlus, sourceshape.NodeBinaryAddExpression},
	boe{tokenTypeMinus, sourceshape.NodeBinarySubtractExpression},
	boe{tokenTypeModulo, sourceshape.NodeBinaryModuloExpression},
	boe{tokenTypeTimes, sourceshape.NodeBinaryMultiplyExpression},
	boe{tokenTypeDiv, sourceshape.NodeBinaryDivideExpression},

	boe{tokenTypeIsOperator, sourceshape.NodeIsComparisonExpression},

	boe{tokenTypeInOperator, sourceshape.NodeInCollectionExpression},
}

BinaryOperators defines the binary operators in precedence order.

Functions

func Parse

func Parse(builder shared.NodeBuilder, importReporter packageloader.ImportHandler, source compilercommon.InputSource, input string) (shared.AstNode, bool)

Parse performs parsing of the given input string and returns the root AST node.

func ParseExpression

func ParseExpression(builder shared.NodeBuilder, source compilercommon.InputSource, startIndex int, input string) (shared.AstNode, bool)

ParseExpression parses the given string as an expression.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL