MQTTSuite
Loading...
Searching...
No Matches
inja::Token Struct Reference

Helper-class for the inja Lexer. More...

#include <inja.hpp>

Collaboration diagram for inja::Token:

Public Types

enum class  Kind {
  Text , ExpressionOpen , ExpressionClose , LineStatementOpen ,
  LineStatementClose , StatementOpen , StatementClose , CommentOpen ,
  CommentClose , Id , Number , String ,
  Plus , Minus , Times , Slash ,
  Percent , Power , Comma , Dot ,
  Colon , LeftParen , RightParen , LeftBracket ,
  RightBracket , LeftBrace , RightBrace , Equal ,
  NotEqual , GreaterThan , GreaterEqual , LessThan ,
  LessEqual , Unknown , Eof
}

Public Member Functions

constexpr Token ()=default
constexpr Token (Kind kind, std::string_view text)
std::string describe () const

Public Attributes

Kind kind {Kind::Unknown}
std::string_view text

Detailed Description

Helper-class for the inja Lexer.

Definition at line 1024 of file inja.hpp.

Member Enumeration Documentation

◆ Kind

enum class inja::Token::Kind
strong
Enumerator
Text 
ExpressionOpen 
ExpressionClose 
LineStatementOpen 
LineStatementClose 
StatementOpen 
StatementClose 
CommentOpen 
CommentClose 
Id 
Number 
String 
Plus 
Minus 
Times 
Slash 
Percent 
Power 
Comma 
Dot 
Colon 
LeftParen 
RightParen 
LeftBracket 
RightBracket 
LeftBrace 
RightBrace 
Equal 
NotEqual 
GreaterThan 
GreaterEqual 
LessThan 
LessEqual 
Unknown 
Eof 

Definition at line 1025 of file inja.hpp.

1025 {
1026 Text,
1027 ExpressionOpen, // {{
1028 ExpressionClose, // }}
1029 LineStatementOpen, // ##
1030 LineStatementClose, // \n
1031 StatementOpen, // {%
1032 StatementClose, // %}
1033 CommentOpen, // {#
1034 CommentClose, // #}
1035 Id, // this, this.foo
1036 Number, // 1, 2, -1, 5.2, -5.3
1037 String, // "this"
1038 Plus, // +
1039 Minus, // -
1040 Times, // *
1041 Slash, // /
1042 Percent, // %
1043 Power, // ^
1044 Comma, // ,
1045 Dot, // .
1046 Colon, // :
1047 LeftParen, // (
1048 RightParen, // )
1049 LeftBracket, // [
1050 RightBracket, // ]
1051 LeftBrace, // {
1052 RightBrace, // }
1053 Equal, // ==
1054 NotEqual, // !=
1055 GreaterThan, // >
1056 GreaterEqual, // >=
1057 LessThan, // <
1058 LessEqual, // <=
1059 Unknown,
1060 Eof,
1061 };

Constructor & Destructor Documentation

◆ Token() [1/2]

inja::Token::Token ( )
explicitconstexprdefault

◆ Token() [2/2]

inja::Token::Token ( Kind kind,
std::string_view text )
inlineexplicitconstexpr

Definition at line 1067 of file inja.hpp.

1068 : kind(kind)
1069 , text(text) {
1070 }
std::string_view text
Definition inja.hpp:1064
Kind kind
Definition inja.hpp:1063

References kind, and text.

Referenced by inja::Lexer::make_token(), and inja::Lexer::scan().

Here is the caller graph for this function:

Member Function Documentation

◆ describe()

std::string inja::Token::describe ( ) const
inline

Definition at line 1072 of file inja.hpp.

1072 {
1073 switch (kind) {
1074 case Kind::Text:
1075 return "<text>";
1077 return "<eol>";
1078 case Kind::Eof:
1079 return "<eof>";
1080 default:
1081 return static_cast<std::string>(text);
1082 }
1083 }

References Eof, kind, LineStatementClose, Text, and text.

Referenced by inja::Parser::parse_expression(), inja::Parser::parse_filename(), inja::Parser::parse_into(), and inja::Parser::parse_statement().

Here is the caller graph for this function:

Member Data Documentation

◆ kind

◆ text


The documentation for this struct was generated from the following file: