kDB: Knowledge DataBase
Loading...
Searching...
No Matches
Token_p.h
1/*
2 * Copyright (c) 2008,2010,2015 Cyrille Berger <cberger@cberger.net>
3 *
4 */
5
6#ifndef _SML_TOKEN_H_
7#define _SML_TOKEN_H_
8
9#include <QString>
10#include <sstream>
11
12#include <knowCore/Curie.h>
13
14namespace kDB::Repository::VersionControl::DeltaParser
15{
16 struct Token
17 {
21 enum Type
22 {
23 // Not really token
24 UNFINISHED_STRING = -4,
25 END_OF_FILE = -3,
26 END_OF_LINE = -2,
27 UNKNOWN = -1,
28 // Special characters
29 SEMI = 0,
40 QUESTION,
42 CIRCUMFLEXCIRCUMFLEX,
43 // Constants
44 FLOAT_CONSTANT,
45 INTEGER_CONSTANT,
46 STRING_CONSTANT,
47 URI_CONSTANT,
48 BINDING,
49 IDENTIFIER,
50 LANG_TAG,
51 CURIE_CONSTANT,
52 // Keywords
53 DELETE,
54 DATA,
55 INSERT,
56 // Needed for reusing BaseParser
57 A,
58 TRUE,
59 FALSE,
60 LOAD_FILE
61 };
65 int line;
67 int column;
69 QString string;
70 // Curie
71 knowCore::Curie curie;
72 Token();
73 Token(const knowCore::Curie& _curie, int _line, int _column);
77 Token(Type _type, int _line, int _column);
81 Token(Type _type, const QString& _string, int _line, int _column);
82 bool isExpressionTerminal();
83 bool isConstant() const;
84 bool isPrimary() const;
85 static QString typeToString(Type);
86 QString toString() const;
87 };
88} // namespace kDB::Repository::VersionControl::DeltaParser
89
90#include <knowCore/Formatter.h>
91
93{
94 return format_to(ctx.out(), "{}", p);
95}
96
97#endif
Definition Curie.h:22
QString string
String or identifier name.
Definition Token_p.h:69
Type type
type of the token
Definition Token_p.h:63
int column
Column of the token.
Definition Token_p.h:67
int line
line of the token
Definition Token_p.h:65