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
15{
16 namespace RDFView
17 {
18 namespace SML
19 {
20 struct Token {
24 enum Type {
25 // Not really token
26 UNFINISHED_STRING = -4,
27 END_OF_FILE = -3,
28 END_OF_LINE = -2,
29 UNKNOWN = - 1,
30 // Special characters
31 SEMI = 0,
42 QUESTION,
44 CIRCUMFLEXCIRCUMFLEX,
45 // Constants
46 FLOAT_CONSTANT,
47 INTEGER_CONSTANT,
48 STRING_CONSTANT,
49 URI_CONSTANT,
50 BINDING,
51 IDENTIFIER,
52 LANG_TAG,
53 CURIE_CONSTANT,
54 // Keywords
55 A,
56 AS,
57 BASE,
58 CONSTRAIN,
59 CONSTRUCT,
60 CREATE,
61 FROM,
62 PREFIX,
63 VIEW,
64 WITH,
65 TRUE,
66 FALSE,
67 // Not valid on SML:
68 LOAD_FILE
69 };
73 int line;
75 int column;
77 QString string;
78 // Curie
79 knowCore::Curie curie;
80 Token();
81 Token(const knowCore::Curie& _curie, int _line, int _column);
85 Token(Type _type, int _line, int _column);
89 Token(Type _type, const QString& _string, int _line, int _column);
90 bool isExpressionTerminal();
91 bool isConstant() const;
92 bool isPrimary() const;
93 static QString typeToString(Type );
94 QString toString() const;
95 };
96 }
97 }
98};
99
100
101#endif
Definition Curie.h:22
Definition Token_p.h:20
Type type
type of the token
Definition Token_p.h:71
QString string
String or identifier name.
Definition Token_p.h:77
int line
line of the token
Definition Token_p.h:73
Type
Definition Token_p.h:24
@ STARTBRACE
{
Definition Token_p.h:35
@ UNDERSCORECOLON
< ?
Definition Token_p.h:43
@ EQUAL
=
Definition Token_p.h:41
@ STARTBRACKET
(
Definition Token_p.h:37
@ COMA
,
Definition Token_p.h:33
@ ENDBRACE
}
Definition Token_p.h:36
@ COLON
:
Definition Token_p.h:32
@ DOT
Definition Token_p.h:34
@ SEMI
;
Definition Token_p.h:31
@ STARTBOXBRACKET
[
Definition Token_p.h:39
@ ENDBRACKET
)
Definition Token_p.h:38
@ ENDBOXBRACKET
]
Definition Token_p.h:40
int column
Column of the token.
Definition Token_p.h:75