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 {
20 enum Type {
21 // Not really token
22 UNFINISHED_STRING = -4,
23 END_OF_FILE = -3,
24 END_OF_LINE = -2,
25 UNKNOWN = - 1,
26 // Special characters
27 SEMI = 0,
38 QUESTION,
40 CIRCUMFLEXCIRCUMFLEX,
41 // Constants
42 FLOAT_CONSTANT,
43 INTEGER_CONSTANT,
44 STRING_CONSTANT,
45 URI_CONSTANT,
46 BINDING,
47 IDENTIFIER,
48 LANG_TAG,
49 CURIE_CONSTANT,
50 // Keywords
51 DELETE,
52 DATA,
53 INSERT,
54 // Needed for reusing BaseParser
55 A,
56 TRUE,
57 FALSE,
58 LOAD_FILE
59 };
63 int line;
65 int column;
67 QString string;
68 // Curie
69 knowCore::Curie curie;
70 Token();
71 Token ( const knowCore::Curie& _curie, int _line, int _column );
75 Token ( Type _type, int _line, int _column );
79 Token ( Type _type, const QString& _string, int _line, int _column );
80 bool isExpressionTerminal();
81 bool isConstant() const;
82 bool isPrimary() const;
83 static QString typeToString ( Type );
84 QString toString() const;
85 };
86}
87
88#endif
Definition Curie.h:22
QString string
String or identifier name.
Definition Token_p.h:67
Type type
type of the token
Definition Token_p.h:61
int column
Column of the token.
Definition Token_p.h:65
int line
line of the token
Definition Token_p.h:63