senf::console::Token Class Reference
[The parser]

Single argument token. More...

#include <senf/Utils/Console/Parse.hh>

List of all members.


Detailed Description

Single argument token.

All command arguments are split into tokens by the parser. Each token is returned as an Token instance.

Definition at line 220 of file Parse.hh.


Public Types

enum   TokenType {
  None = 0, PathSeparator = 0x0001, ArgumentGroupOpen = 0x0002, ArgumentGroupClose = 0x0004,
  DirectoryGroupOpen = 0x0008, DirectoryGroupClose = 0x0010, CommandTerminator = 0x0020, OtherPunctuation = 0x0040,
  BasicString = 0x0080, HexString = 0x0100, Word = 0x0200
}
enum   TokenGroup {
  ArgumentGrouper, DirectoryGrouper, Punctuation, String,
  SimpleArgument
}

Public Member Functions

  Token ()
  Create empty token.
  Token (TokenType type, std::string token)
  Create token with given type and value.
  Token (TokenType type, std::string token, detail::FilePositionWithIndex const &pos)
  Create token with given type and value.
std::string const &  value () const
  String value of token.
TokenType  type () const
  Token type.
unsigned  line () const
  Line number of token in source.
unsigned  column () const
  Column number of token in source.
unsigned  index () const
  Index (char count) of token in source.
bool  is (unsigned tokens) const
  Check, whether tokens type matches tokens.
bool  operator== (Token const &other) const
bool  operator!= (Token const &other) const

Related Functions

(Note that these are not member functions.)

Token  NoneToken ()
  Create a None token.
Token  PathSeparatorToken ()
  Create a PathSeparator ['/'] token.
Token  ArgumentGroupOpenToken ()
  Create an ArgumentGroupOpen ['('] token.
Token  ArgumentGroupCloseToken ()
  Create a ArgumentGroupClose [')'] token.
Token  DirectoryGroupOpenToken ()
  Create a DirectoryGroupOpen ['{'] token.
Token  DirectoryGroupCloseToken ()
  Create a DirectoryGroupClose ['}'] token.
Token  CommandTerminatorToken ()
  Create a CommandTerminator [';'] token.
Token  OtherPunctuationToken (std::string const &value)
  Create a OtherPunctuation ['=', ','] token with the given value.
Token  BasicStringToken (std::string const &value)
  Create a BasicString token with the given value.
Token  HexStringToken (std::string const &value)
  Create a HexString token with the given value.
Token  WordToken (std::string const &value)
  Create a Word token with the given value.

Member Enumeration Documentation

enum senf::console::Token::
TokenGroup
Enumerator:
ArgumentGrouper 
DirectoryGrouper 
Punctuation 
String 
SimpleArgument 

Definition at line 237 of file Parse.hh.

enum senf::console::Token::
TokenType
Enumerator:
None 
PathSeparator 
ArgumentGroupOpen 
ArgumentGroupClose 
DirectoryGroupOpen 
DirectoryGroupClose 
CommandTerminator 
OtherPunctuation 
BasicString 
HexString 
Word 

Definition at line 223 of file Parse.hh.


Constructor & Destructor Documentation

senf::console::Token::
Token ()

Create empty token.

Definition at line 86 of file Parse.cci.

senf::console::Token::
Token ( TokenType  type,
std::string  token )

Create token with given type and value.

Definition at line 90 of file Parse.cci.

senf::console::Token::
Token ( TokenType  type,
std::string  token,
detail::FilePositionWithIndex const &  pos )

Create token with given type and value.

Definition at line 134 of file Parse.cc.


Member Function Documentation

unsigned senf::console::Token::
column ()

Column number of token in source.

Definition at line 56 of file Parse.cci.

unsigned senf::console::Token::
index ()

Index (char count) of token in source.

Definition at line 62 of file Parse.cci.

bool senf::console::Token::
is ( unsigned  tokens )

Check, whether tokens type matches tokens.

tokens is a bit-mask of token types to check.

Definition at line 68 of file Parse.cci.

unsigned senf::console::Token::
line ()

Line number of token in source.

Definition at line 50 of file Parse.cci.

bool senf::console::Token::
operator!= ( Token const &  other )

Definition at line 80 of file Parse.cci.

bool senf::console::Token::
operator== ( Token const &  other )

Definition at line 74 of file Parse.cci.

senf::console::Token::TokenType senf::console::Token::
type ()

Token type.

Definition at line 44 of file Parse.cci.

std::string const & senf::console::Token::
value ()

String value of token.

This value is properly unquoted

Definition at line 38 of file Parse.cci.


Friends And Related Function Documentation

Token
ArgumentGroupCloseToken ()

Create a ArgumentGroupClose [')'] token.

Token
ArgumentGroupOpenToken ()

Create an ArgumentGroupOpen ['('] token.

Token
BasicStringToken ( std::string const &  value )

Create a BasicString token with the given value.

Token
CommandTerminatorToken ()

Create a CommandTerminator [';'] token.

Token
DirectoryGroupCloseToken ()

Create a DirectoryGroupClose ['}'] token.

Token
DirectoryGroupOpenToken ()

Create a DirectoryGroupOpen ['{'] token.

Token
HexStringToken ( std::string const &  value )

Create a HexString token with the given value.

Token
NoneToken ()

Create a None token.

Token
OtherPunctuationToken ( std::string const &  value )

Create a OtherPunctuation ['=', ','] token with the given value.

Token
PathSeparatorToken ()

Create a PathSeparator ['/'] token.

Token
WordToken ( std::string const &  value )

Create a Word token with the given value.


The documentation for this class was generated from the following files: