Documentation ¶
Overview ¶
Package parser implements a tolerant TTCN-3 parser library.
It implements most of TTCN-3 core language specification 4.10 (2018), Advanced Parametrisation, Behaviour Types, Performance and Realtime Testing, simplistic preprocessor support, multi-line string literals for Titan TestPorts, and optional semicolon for backward compatibility.
Index ¶
Constants ¶
const ( PedanticSemicolon = 1 << iota // expect semicolons pedantically IgnoreComments // ignore comments Trace // print a trace of parsed productions AllErrors // report all errors (not just the first 10 on different lines) )
Variables ¶
This section is empty.
Functions ¶
func ParseModules ¶
func ParseModules(fset *loc.FileSet, filename string, src interface{}, mode Mode) (root []*ast.Module, err error)
ParseModules parses the source code of a single source file and returns the corresponding nodes. The source code may be provided via the filename of the source file, or via the src parameter.
If src != nil, ParseModules parses the source from src and the filename is only used when recording position information. The type of the argument for the src parameter must be string, []byte, or io.Reader. If src == nil, ParseModules parses the file specified by filename.
The mode parameter controls the amount of source text parsed and other optional parser functionality. Position information is recorded in the file set fset, which must not be nil.
If the source couldn't be read, the returned AST is nil and the error indicates the specific failure. If the source was read but syntax errors were found, the result is a partial AST (with Bad* nodes representing the fragments of erroneous source code). Multiple errors are returned via a ErrorList which is sorted by file position.