| Description | Hierarchy | Fields | Methods | Properties |
type TVRMLLexer = class(TObject)
VRML unified lexer.
The lexer always "looks" (i.e. contains in Token and TokenXxx fields) at the next not yet interpreted token.
Remember that VRML is case-sensitive, so TokenName and TokenString should be compared in case-sensitive manner. Also note that for VRML >= 2.0 these fields contain UTF-8 encoded string.
Note that it can read only from TPeekCharStream, not just from any TStream. You may have to wrap your stream in some TPeekCharStream descendant (see for example at TVRMLLexerFileName implementation, that creates TFileStream and then wraps it inside TBufferedReadStream).
![]() |
WWWBasePath: string; |
![]() |
NodeNameBinding: TStringList; |
![]() |
ProtoNameBinding: TStringList; |
![]() |
function NextToken: TVRMLToken; |
![]() |
procedure NextTokenForceVTName; |
![]() |
procedure NextTokenForceVTString; |
![]() |
function TokenIsKeyword(const Keyword: TVRMLKeyword): boolean; overload; |
![]() |
function TokenIsKeyword(const Keywords: TVRMLKeywords): boolean; overload; |
![]() |
function DescribeToken: string; |
![]() |
procedure CheckTokenIs(Tok: TVRMLToken); overload; |
![]() |
procedure CheckTokenIs(Tok: TVRMLToken; const TokDescription: string); overload; |
![]() |
procedure CheckTokenIs(const Toks: TVRMLTokens; const ToksDescription: string); overload; |
![]() |
procedure CheckTokenIsKeyword(const Keyword: TVRMLKeyword); |
![]() |
constructor Create(AStream: TPeekCharStream; const AWWWBasePath: string); |
![]() |
destructor Destroy; override; |
![]() |
property Stream: TPeekCharStream read FStream; |
![]() |
property VRMLVerMajor: integer read fVRMLVerMajor; |
![]() |
property VRMLVerMinor: integer read fVRMLVerMinor; |
![]() |
property Token: TVRMLToken read fToken; |
![]() |
property TokenKeyword: TVRMLKeyword read fTokenKeyword; |
![]() |
property TokenName: string read fTokenName; |
![]() |
property TokenFloat: Float read fTokenFloat; |
![]() |
property TokenInteger: Int64 read fTokenInteger; |
![]() |
property TokenString: string read fTokenString; |
![]() |
WWWBasePath: string; |
|
See TVRMLNode.WWWBasePath for a description of this field. This field is not used anywhere in the Lexer but it MUST be defined to something sensible. It is just some information "carried with" the lexer. We will use it when we parse nodes. | |
![]() |
NodeNameBinding: TStringList; |
|
This is used when parsing to keep current namespace for DEF/USE.
| |
![]() |
ProtoNameBinding: TStringList; |
|
This is used when parsing to keep current namespace of prototypes. | |
![]() |
function NextToken: TVRMLToken; |
|
| |
![]() |
procedure NextTokenForceVTString; |
|
Similiar to NextTokenForceVTName: use this like a shortcut for NextToken; CheckTokenIs(vtString); but it is NOT equivalent to such instructions. This is because VRML 1.0 allowed rather strange thing: string may be not enclosed in double quotes if it does not contain a space. This "feature" is not present in VRML 97, but, unfortunately, I'm trying to handle VRML 1.0 here so I have to conform to this specification. In particular, Blender generates VRML 1.0 files with Texture2.filename fields not enclosed in double quotes. So this "feature" is actually used by someone... So I have to implement this. Usual NextToken will not be able to return vtString if it approaches a string not enclosed in double quotes. But THIS function will be able to handle it. So always use this function when you expect a string, this ensures that we will correctly parse any valid VRML 1.0 file. (unfortunately I'm not doing this now when parsing MFString, this would just require too "unclean" code; I'm using this function only before calling parse on SFString field from TVRMLNode.Parse.) | |
![]() |
function TokenIsKeyword(const Keyword: TVRMLKeyword): boolean; overload; |
|
Returns if Token is vtKeyword and TokenKeyword is given Keyword. | |
![]() |
function TokenIsKeyword(const Keywords: TVRMLKeywords): boolean; overload; |
![]() |
function DescribeToken: string; |
|
skonstruuj tekstowy opis tokenu ktory nadaje sie do pokazania userowi. | |
![]() |
procedure CheckTokenIs(Tok: TVRMLToken); overload; |
|
Check is token = Tok, if not -> parser error "expected token >>tok<<". You can provide your own description for Tok or default desciption for token will be used. | |
![]() |
procedure CheckTokenIs(Tok: TVRMLToken; const TokDescription: string); overload; |
![]() |
procedure CheckTokenIs(const Toks: TVRMLTokens; const ToksDescription: string); overload; |
![]() |
procedure CheckTokenIsKeyword(const Keyword: TVRMLKeyword); |
![]() |
constructor Create(AStream: TPeekCharStream; const AWWWBasePath: string); |
|
Standard constructor. After constructor call, VRMLVerMajor and VRMLVerMinor are already set, it's checked that file is not compressed by gzip, and the first Token is already read. Exceptions raised
| |
![]() |
destructor Destroy; override; |
![]() |
property Stream: TPeekCharStream read FStream; |
|
to po prostu strumien ktory dostalismy jako parametr konstruktora. Nie mozesz na nim operowac kiedy juz zainicjowales lexera ! Ale mozesz np. sprawdzic jego Position aby wiedziec gdzie mniej wiecej bylismy w strumieniu gdy wystapil blad lexera. | |
![]() |
property VRMLVerMajor: integer read fVRMLVerMajor; |
|
These indicate VRML version, as recorded in VRML file header. The only versions allowed by any VRML specifications are 1.0 and 2.0. Moreover we handle Inventor 1.0 ascii, then we set | |
![]() |
property VRMLVerMinor: integer read fVRMLVerMinor; |
![]() |
property Token: TVRMLToken read fToken; |
|
Token na jakim aktualnie stoimy. Odpowiednie pola TokenKeyword, TokenName, TokenFloat i TokenInteger maja defined wartosci tylko jezeli typ tokenu jest odpowiedni. | |
![]() |
property TokenKeyword: TVRMLKeyword read fTokenKeyword; |
|
When Token = vtKeyword, | |
![]() |
property TokenFloat: Float read fTokenFloat; |
|
When Token = vtFloat or vtInteger, VRML float token corresponds to Pascal Float type, in VRML it's expressed in the followin form:
[("-"|"+")]
(digit+ [ "." digit+ ] | "." digit+)
[ "e"|"E" [("-"|"+")] digit+ ]
For vtInteger you have the same thing in TokenInteger, | |
![]() |
property TokenString: string read fTokenString; |