|
Class: XDRScanner (in SunRPC)
Object
|
+--Scanner
|
+--SunRPC::XDRScanner
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-SunRPC-XDR_IDL
- Version:
- rev:
1.17
date: 2024/04/22 17:44:58
- user: stefan
- file: SunRPC_XDRScanner.st directory: goodies/communication
- module: stx stc-classLibrary: communication
scanner for XDR-definition files - provides token scanning functionality
for the XDRParser. (normally not used by its own).
XDR is the IDL of SunRPC.
copyrightCOPYRIGHT (c) 2002 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
syntax<<END
declaration:
type-specifier identifier
| type-specifier identifier "[" value "]"
| type-specifier identifier "<" [ value ] ">"
| "opaque" identifier "[" value "]"
| "opaque" identifier "<" [ value ] ">"
| "string" identifier "<" [ value ] ">"
| type-specifier "*" identifier
| "void"
value:
constant
| identifier
type-specifier:
[ "unsigned" ] "int"
| [ "unsigned" ] "hyper"
| "float"
| "double"
| "bool"
| enum-type-spec
| struct-type-spec
| union-type-spec
| identifier
enum-type-spec:
"enum" enum-body
enum-body:
"{"
( identifier "=" value )
( "," identifier "=" value )*
"}"
struct-type-spec:
"struct" struct-body
struct-body:
"{"
( declaration ";" )
( declaration ";" )*
"}"
union-type-spec:
"union" union-body
union-body:
"switch" "(" declaration ")" "{"
( "case" value ":" declaration ";" )
( "case" value ":" declaration ";" )*
[ "default" ":" declaration ";" ]
"}"
constant-def:
"const" identifier "=" constant ";"
type-def:
"typedef" declaration ";"
| "enum" identifier enum-body ";"
| "struct" identifier struct-body ";"
| "union" identifier union-body ";"
program-def:
"program" identifier "{"
version-def
version-def *
"}" "=" constant ";"
version-def:
"version" identifier "{"
procedure-def
procedure-def *
"}" "=" constant ";"
procedure-def:
type-specifier identifier "(" type-specifier
("," type-specifier )* ")" "=" constant ";"
definition:
type-def
| constant-def
| program-def
specification:
definition *
END"
initialization
-
initialize
-
(comment from inherited method)
initialize the classes defaults. Typically, these are changed
later in the 'private.rc' file.
-
setupActions
-
initialize the scanners actionTables - these are used to dispatch
into scanner methods as characters are read
Usage example(s):
-
update: something with: parameter from: changedObject
-
bug work-around (compiled cheap blocks loose their code)
accessing
-
newSource: aStringOrStream
-
-
source
-
initialization
-
initialize
-
initialize the scanner
private
-
checkForKeyword: string
-
check if string is a keyword (as opposed to an identifier).
-
isCommentCharacter: ch
-
return true, if ch is the comment-start character
-
pushBack: aToken
-
-
skipForClosing: closingToken with: openingToken
-
reading next token
-
nextCharacter
-
a single quote has been scanned; scan the character-string (caring for quotes).
TODO: C-escapes; \0xx; \0xxx
-
nextEq
-
'=' has been read - look for another '='
-
nextGT
-
'>' has been read - look for another '>'
-
nextLT
-
'<' has been read - look for another '<'
-
nextMinus
-
'-' has been read - look for another '-'
-
nextNumber
-
a digit has been read; scan a number (0xfoo / 0octal / decimal or float).
if specialFloat is true, return float value as hi.low (for version numbers)
-
nextPlus
-
'+' has been read - look for another '+'
-
nextSlash
-
'/' has been read - next could be:
'/' - EOL comment
'*' - regular comment
-
nextString
-
a doubled quote has been scanned; scan the string (caring for doubled quotes
-
nextToken
-
return the next token from my source-stream
specials
-
readingStream: aStream do: aBlock
-
-
restOfLine
-
|