glib.scanner
Module for [Scanner] class
class Scanner
Types 1
classScanner
glib.scanner.Scanner provides a general-purpose lexical scanner.
You should set @input_name after creating the scanner, since it is used by the default message handler when displaying warnings and errors. If you are scanning a file, the filename would be a good choice.
The @user_data and @max_parse_errors fields are not used. If you need to associate extra data with the scanner you can place them here.
If you want to use your own message handler you can set the @msg_handler field. The type of the message handler function is declared by #GScannerMsgFunc.
Fields
GScanner _cInstanceMethods
void * _cPtr() nothrowvoid maxParseErrors(uint propval) @property nothrowSet `maxParseErrors` field. Params: propval = unuseduint parseErrors() @property nothrowGet `parseErrors` field. Returns: [glib.scanner.Scanner.error] increments this fieldvoid parseErrors(uint propval) @property nothrowSet `parseErrors` field. Params: propval = [glib.scanner.Scanner.error] increments this fieldstring inputName() @property nothrowGet `inputName` field. Returns: name of input stream, featured by the default message handlervoid inputName(string propval) @property nothrowSet `inputName` field. Params: propval = name of input stream, featured by the default message handlerglib.scanner_config.ScannerConfig config() @property nothrowGet `config` field. Returns: link into the scanner configurationglib.types.TokenType token() @property nothrowGet `token` field. Returns: token parsed by the last [glib.scanner.Scanner.getNextToken]void token(glib.types.TokenType propval) @property nothrowSet `token` field. Params: propval = token parsed by the last [glib.scanner.Scanner.getNextToken]glib.token_value.TokenValue value() @property nothrowGet `value` field. Returns: value of the last token from [glib.scanner.Scanner.getNextToken]uint line() @property nothrowGet `line` field. Returns: line number of the last token from [glib.scanner.Scanner.getNextToken]void line(uint propval) @property nothrowSet `line` field. Params: propval = line number of the last token from [glib.scanner.Scanner.getNextToken]uint position() @property nothrowGet `position` field. Returns: char number of the last token from [glib.scanner.Scanner.getNextToken]void position(uint propval) @property nothrowSet `position` field. Params: propval = char number of the last token from [glib.scanner.Scanner.getNextToken]glib.types.TokenType nextToken() @property nothrowGet `nextToken` field. Returns: token parsed by the last [glib.scanner.Scanner.peekNextToken]void nextToken(glib.types.TokenType propval) @property nothrowSet `nextToken` field. Params: propval = token parsed by the last [glib.scanner.Scanner.peekNextToken]glib.token_value.TokenValue nextValue() @property nothrowGet `nextValue` field. Returns: value of the last token from [glib.scanner.Scanner.peekNextToken]uint nextLine() @property nothrowGet `nextLine` field. Returns: line number of the last token from [glib.scanner.Scanner.peekNextToken]void nextLine(uint propval) @property nothrowSet `nextLine` field. Params: propval = line number of the last token from [glib.scanner.Scanner.peekNextToken]uint nextPosition() @property nothrowGet `nextPosition` field. Returns: char number of the last token from [glib.scanner.Scanner.peekNextToken]void nextPosition(uint propval) @property nothrowSet `nextPosition` field. Params: propval = char number of the last token from [glib.scanner.Scanner.peekNextToken]GScannerMsgFunc msgHandler() @property nothrowGet `msgHandler` field. Returns: handler function for warn and errorvoid msgHandler(GScannerMsgFunc propval) @property nothrowSet `msgHandler` field. Params: propval = handler function for warn and erroruint curLine() nothrowReturns the current line in the input stream (counting from 1). This is the line of the last token parsed via [glib.scanner.Scanner.getNextToken]. Returns: the current lineuint curPosition() nothrowReturns the current position in the current line (counting from 0). This is the position of the last token parsed via [glib.scanner.Scanner.getNextToken]. Returns: the current position on the lineglib.types.TokenType curToken() nothrowGets the current token type. This is simply the token field in the #GScanner structure. Returns: the current token typebool eof() nothrowReturns true if the scanner has reached the end of the file or text buffer. Returns: true if the scanner has reached the end of the file or text bufferglib.types.TokenType getNextToken() nothrowParses the next token just like [glib.scanner.Scanner.peekNextToken] and also removes it from the input stream. The token data is placed in the token, value, line, and position fields of the #GScan...void * lookupSymbol(string symbol) nothrowLooks up a symbol in the current scope and return its value. If the symbol is not bound in the current scope, null is returned.glib.types.TokenType peekNextToken() nothrowParses the next token, without removing it from the input stream. The token data is placed in the next_token, next_value, next_line, and next_position fields of the #GScanner structure.void scopeAddSymbol(uint scopeId, string symbol, void * value = null) nothrowAdds a symbol to the given scope.void scopeForeachSymbol(uint scopeId, glib.types.HFunc func) nothrowCalls the given function for each of the symbol/value pairs in the given scope of the #GScanner. The function is passed the symbol and value of each pair, and the given user_data parameter.void * scopeLookupSymbol(uint scopeId, string symbol) nothrowLooks up a symbol in a scope and return its value. If the symbol is not bound in the scope, null is returned.void syncFileOffset() nothrowRewinds the filedescriptor to the current buffer position and blows the file read ahead buffer. This is useful for third party uses of the scanners filedescriptor, which hooks onto the current scan...void unexpToken(glib.types.TokenType expectedToken, string identifierSpec, string symbolSpec, string symbolName, string message, int isError) nothrowOutputs a message through the scanner's msg_handler, resulting from an unexpected token in the input stream. Note that you should not call [glib.scanner.Scanner.peekNextToken] followed by [glib.sca...Destructors