Support Forum       G3D Web Page     
Public Member Functions | Public Attributes | List of all members
G3D::TextInput::Settings Class Reference

Tokenizer configuration options. More...

Public Member Functions

 Settings ()
 

Public Attributes

bool caseSensitive
 
When parsing booleans and msvcFloatSpecials, is case significant? Default is {true} More...
 
bool cppBlockComments
 If true, C-style slash-star marks a multi-line comment. More...
 
bool cppLineComments
 If true, // begins a single line comment. More...
 
bool escapeSequencesInStrings
 If true, \r, \n, \t, \0, \\ and other escape sequences inside strings are converted to the equivalent C++ escaped character. More...
 
Set< StringfalseSymbols
 See trueSymbols. More...
 
bool generateCommentTokens
 If true, comments enabled by cppBlockComments, cppLineComments and otherLineComments will generate their respective tokens. More...
 
bool generateNewlineTokens
 If true, newlines will generate tokens. More...
 
bool msvcFloatSpecials
 
Parse "-1.#IND00" as the floating point number returned by G3D::nan(), "-1.#INF00" as - G3D::inf(), and "1.#INF00" as G3D::inf(). More...
 
char otherCommentCharacter
 If not '\0', specifies a character that begins single line comments ('#' and '' are popular choices). More...
 
char otherCommentCharacter2
 Another (optional) 1-comment character. More...
 
bool otherLineComments
 If true, otherCommentCharacter and otherCommentCharacter2 are used to begin single line comments in the same way cppLineComments is. More...
 
bool proofSymbols
 
Parse the following set of useful proof symbols: More...
 
bool signedNumbers
 If true, "-1" parses as the number -1 instead of the symbol "-" followed by the number 1. More...
 
bool simpleFloatSpecials
 Parses "+inf', "-inf", "inf", "nan" as floats instead of symbols. More...
 
char singleQuoteCharacter
 The character to use as a single quote. More...
 
bool singleQuotedStrings
 If true, strings can be marked with single quotes (e.g., 'aaa'). More...
 
String sourceFileName
 If set to a non-empty string, that string will be used in place of the real file name (or in place of a pseudonym constructed from the buffer if given FROM_STRING) in tokens and exceptions. More...
 
int startingLineNumberOffset
 Added to the line number reported by peekLineNumber and in exceptions. More...
 
Set< StringtrueSymbols
 All symbols that will become the 'true' boolean token. More...
 

Detailed Description

Tokenizer configuration options.

Constructor & Destructor Documentation

◆ Settings()

G3D::TextInput::Settings::Settings ( )

Member Data Documentation

◆ caseSensitive

bool G3D::TextInput::Settings::caseSensitive


When parsing booleans and msvcFloatSpecials, is case significant? Default is {true}

◆ cppBlockComments

bool G3D::TextInput::Settings::cppBlockComments

If true, C-style slash-star marks a multi-line comment.

See generateCommentTokens for rules on how this is applied.

Default is true.

◆ cppLineComments

bool G3D::TextInput::Settings::cppLineComments

If true, // begins a single line comment.

See generateCommentTokens for rules on how this is applied.

Default is true.

◆ escapeSequencesInStrings

bool G3D::TextInput::Settings::escapeSequencesInStrings

If true, \r, \n, \t, \0, \\ and other escape sequences inside strings are converted to the equivalent C++ escaped character.

If false, backslashes are treated literally. It is convenient to set to false if reading Windows paths, for example, like c:\foo\bar.

Default is true.

◆ falseSymbols

Set<String> G3D::TextInput::Settings::falseSymbols

See trueSymbols.

Default is {false}

◆ generateCommentTokens

bool G3D::TextInput::Settings::generateCommentTokens

If true, comments enabled by cppBlockComments, cppLineComments and otherLineComments will generate their respective tokens.

If false, the same settings will enable parsing and ignoring comments

Default is false.

◆ generateNewlineTokens

bool G3D::TextInput::Settings::generateNewlineTokens

If true, newlines will generate tokens.

If false, newlines will be discarded as whitespace when parsed outside of other tokens. Newlines in Strings are always parsed as newlines.

Default is false.

◆ msvcFloatSpecials

bool G3D::TextInput::Settings::msvcFloatSpecials


Parse "-1.#IND00" as the floating point number returned by G3D::nan(), "-1.#INF00" as - G3D::inf(), and "1.#INF00" as G3D::inf().

Note that the C99 standard specifies that a variety of formats like "nan" are to be used; these are supported by G3D::TextInput::Settings::simpleFloatSpecials.

An alternative to specifying msvcFloatSpecials is to read numbers as:

  Token x = t.read();
  Token y = t.peek();
  if ((x.string() == "-1.") && 
      (y.string() == "#INF00") && 
      (y.character() == x.character() + 3) &&
      (y.line() == x.line()) {
      t.read();
      return nan();
  }
  // ... similar cases for inf

If the single-comment character was #, the floating point special format overrides the comment and will be parsed instead.

If signedNumbers is false msvcFloatSpecials will not be parsed.

Default is true.

◆ otherCommentCharacter

char G3D::TextInput::Settings::otherCommentCharacter

If not '\0', specifies a character that begins single line comments ('#' and '' are popular choices).

This is independent of the cppLineComments flag. If the character appears in text with a backslash in front of it, it is considered escaped and is not treated as a comment character.

Default is '\0'.

◆ otherCommentCharacter2

char G3D::TextInput::Settings::otherCommentCharacter2

Another (optional) 1-comment character.

Useful for files that support multiple comment syntaxes. Default is '\0'.

◆ otherLineComments

bool G3D::TextInput::Settings::otherLineComments

If true, otherCommentCharacter and otherCommentCharacter2 are used to begin single line comments in the same way cppLineComments is.

See generateCommentTokens for rules on how this is applied.

Default is true.

◆ proofSymbols

bool G3D::TextInput::Settings::proofSymbols


Parse the following set of useful proof symbols:

=> ::> <:: :> <: |- ::= := <-

Default is false.

◆ signedNumbers

bool G3D::TextInput::Settings::signedNumbers

If true, "-1" parses as the number -1 instead of the symbol "-" followed by the number 1.

Default is true.

◆ simpleFloatSpecials

bool G3D::TextInput::Settings::simpleFloatSpecials

Parses "+inf', "-inf", "inf", "nan" as floats instead of symbols.

Defaults to true.

◆ singleQuoteCharacter

char G3D::TextInput::Settings::singleQuoteCharacter

The character to use as a single quote.

Defaults to "'" (backquote), occasionally useful to set to "`" (forward quote) or to "," (comma) for reading CSV files.

◆ singleQuotedStrings

bool G3D::TextInput::Settings::singleQuotedStrings

If true, strings can be marked with single quotes (e.g., 'aaa').

If false, the quote character is parsed as a symbol. Default is true. Backquote (`) is always parsed as a symbol.

◆ sourceFileName

String G3D::TextInput::Settings::sourceFileName

If set to a non-empty string, that string will be used in place of the real file name (or in place of a pseudonym constructed from the buffer if given FROM_STRING) in tokens and exceptions.

Default is empty.

◆ startingLineNumberOffset

int G3D::TextInput::Settings::startingLineNumberOffset

Added to the line number reported by peekLineNumber and in exceptions.

Useful for concatenating files that are parsed separately. Default is zero.

◆ trueSymbols

Set<String> G3D::TextInput::Settings::trueSymbols

All symbols that will become the 'true' boolean token.

See also caseSensitive. Clear this value to disable parsing of true booleans.

Default is {true}.


documentation generated on Wed Nov 24 2021 08:02:01 using doxygen 1.8.15