Unit X3DLexer

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

VRML/X3D classic lexer (TX3DLexer).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class EX3DGzipCompressed  
Object TX3DVersion  
Class TX3DLexer VRML/X3D (classic encoding) lexer.
Class EX3DError Any error related to VRML/X3D.
Class EX3DClassicReadError Error when reading VRML/X3D classic encoding.
Class EX3DLexerError  
Class EX3DParserError  

Functions and Procedures

function StringToX3DClassic(const s: string): string;
function StringToX3DXml(const s: string): string;
function StringToX3DXmlMulti(const s: string): string;

Types

TX3DKeyword = (...);
TX3DKeywords = set of TX3DKeyword;
TX3DToken = (...);
TX3DTokens = set of TX3DToken;
TX3DEncoding = (...);
EX3DReadError = EX3DClassicReadError;

Constants

VRML10Keywords = [vkDEF, vkUSE, vkFALSE, vkTRUE];
VRML20Keywords = [vkDEF .. vkIMPORT];
X3DKeywords = [Low(TX3DKeyword) .. High(TX3DKeyword)] - [vkEventIn, vkEventOut, vkExposedField, vkField];
TokenNumbers : TX3DTokens = [vtFloat, vtInteger];
X3DKeywordsName: array [TX3DKeyword] of string = ( 'DEF', 'EXTERNPROTO', 'FALSE', 'IS', 'NULL', 'PROTO', 'ROUTE', 'TO', 'TRUE', 'USE', 'eventIn', 'eventOut', 'exposedField', 'field', 'AS', 'EXPORT', 'IMPORT', 'COMPONENT', 'META', 'PROFILE', 'UNIT', 'inputOnly', 'outputOnly', 'inputOutput', 'initializeOnly' );

Description

Functions and Procedures

function StringToX3DClassic(const s: string): string;

String encoded for VRML/X3D classic, surrounded by double quotes. You can use this when generating VRML/X3D content by hand.

Simply put, this just adds double quotes around and prepends backslash to all " and \ inside. Fortunately, no other characters (including newlines) need to be quoted in any special way for VRML/X3D. For example:

  StringToVRMLStringToken('foo') = '"foo"'
  StringToVRMLStringToken('say "yes"') = '"say \"yes\""'

function StringToX3DXml(const s: string): string;

String encoded for X3D XML, surrounded by double quotes. You can use this when generating VRML/X3D content by hand.

Simply put, this just adds double quotes around and replaces all special characters (quotes, double quotes and more) with appropriate XML entities &xxx;.

function StringToX3DXmlMulti(const s: string): string;

String encoded for X3D XML, surrounded by double quotes, to be used as part of MFString.

In addition to what StringToX3DXml does, this additionally adds backslash before &quot; (double quotes), and doubles existing backslashes. Otherwise XML reader may not tell the difference between double quotes delimiting single string item and double quotes inside, as it has to (and DOM units do) treat " and &quot; exactly the same. X3D XML encoding spec shows example confirming this is correct, <Text string='"He said, \&quot;Immel did it!\&quot;"' />.

Types

TX3DKeyword = (...);

Valid keywords for all VRML / X3D versions.

Values
  • vkDEF:  
  • vkEXTERNPROTO:  
  • vkFALSE:  
  • vkIS:  
  • vkNULL:  
  • vkPROTO:  
  • vkROUTE:  
  • vkTO:  
  • vkTRUE:  
  • vkUSE:  
  • vkEventIn:  
  • vkEventOut:  
  • vkExposedField:  
  • vkField:  
  • vkAS:  
  • vkEXPORT:  
  • vkIMPORT:  
  • vkCOMPONENT:  
  • vkMETA:  
  • vkPROFILE:  
  • vkUNIT:  
  • vkInputOnly:  
  • vkOutputOnly:  
  • vkInputOutput:  
  • vkInitializeOnly:  
TX3DKeywords = set of TX3DKeyword;
 
TX3DToken = (...);

Lexer token.

Values
  • vtKeyword:  
  • vtName:  
  • vtOpenCurlyBracket: Symbols for all VRML versions.
  • vtCloseCurlyBracket:  
  • vtOpenSqBracket:  
  • vtCloseSqBracket:  
  • vtOpenBracket: Symbols below are only for VRML <= 1.0. In VRML 2.0, they are no longer valid symbols (comma is even considered a whitespace). They will never be returned by lexer when reading VRML >= 2.0 files.

  • vtCloseBracket:  
  • vtBar:  
  • vtComma:  
  • vtPeriod: Symbols below are only for VRML >= 2.0. They will never be returned by lexer when reading VRML < 2.0 files.
  • vtColon: Symbols below are only for VRML >= 3.0, that is X3D. They will never be returned by lexer when reading VRML < 3.0 files.
  • vtFloat: Back to version-neutral tokens, suitable for all VRML / X3D versions.
  • vtInteger:  
  • vtString:  
  • vtEnd: vtEnd means that we're standing at the end of stream, no more tokens. From this point, further reads using NextToken from stream will always result in vtEnd (they will not raise an error).
TX3DTokens = set of TX3DToken;
 
TX3DEncoding = (...);
 
Values
  • xeClassic:  
  • xeXML:  
EX3DReadError = EX3DClassicReadError;

Error when reading VRML/X3D. For now, just equal to EX3DClassicReadError, later may be an ancestor to EX3DClassicReadError. Problems in other encodings (XML) are for now always turned into warnings.

Constants

VRML10Keywords = [vkDEF, vkUSE, vkFALSE, vkTRUE];
 
VRML20Keywords = [vkDEF .. vkIMPORT];
 
X3DKeywords = [Low(TX3DKeyword) .. High(TX3DKeyword)] - [vkEventIn, vkEventOut, vkExposedField, vkField];
 
TokenNumbers : TX3DTokens = [vtFloat, vtInteger];
 
X3DKeywordsName: array [TX3DKeyword] of string = ( 'DEF', 'EXTERNPROTO', 'FALSE', 'IS', 'NULL', 'PROTO', 'ROUTE', 'TO', 'TRUE', 'USE', 'eventIn', 'eventOut', 'exposedField', 'field', 'AS', 'EXPORT', 'IMPORT', 'COMPONENT', 'META', 'PROFILE', 'UNIT', 'inputOnly', 'outputOnly', 'inputOutput', 'initializeOnly' );
 

Generated by PasDoc 0.13.0 on 2014-04-30 22:06:47