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 , Pipe , 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 1059 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 
Pipe 
Unknown 
Eof 

Definition at line 1060 of file inja.hpp.

1060 {
1061 Text,
1062 ExpressionOpen, // {{
1063 ExpressionClose, // }}
1064 LineStatementOpen, // ##
1065 LineStatementClose, // \n
1066 StatementOpen, // {%
1067 StatementClose, // %}
1068 CommentOpen, // {#
1069 CommentClose, // #}
1070 Id, // this, this.foo
1071 Number, // 1, 2, -1, 5.2, -5.3
1072 String, // "this"
1073 Plus, // +
1074 Minus, // -
1075 Times, // *
1076 Slash, // /
1077 Percent, // %
1078 Power, // ^
1079 Comma, // ,
1080 Dot, // .
1081 Colon, // :
1082 LeftParen, // (
1083 RightParen, // )
1084 LeftBracket, // [
1085 RightBracket, // ]
1086 LeftBrace, // {
1087 RightBrace, // }
1088 Equal, // ==
1089 NotEqual, // !=
1090 GreaterThan, // >
1091 GreaterEqual, // >=
1092 LessThan, // <
1093 LessEqual, // <=
1094 Pipe, // |
1095 Unknown,
1096 Eof,
1097 };

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 1103 of file inja.hpp.

1104 : kind(kind)
1105 , text(text) {
1106 }
std::string_view text
Definition inja.hpp:1100
Kind kind
Definition inja.hpp:1099

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 1108 of file inja.hpp.

1108 {
1109 switch (kind) {
1110 case Kind::Text:
1111 return "<text>";
1113 return "<eol>";
1114 case Kind::Eof:
1115 return "<eof>";
1116 default:
1117 return static_cast<std::string>(text);
1118 }
1119 }

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: