knowL: Knowledge Libraries
Loading...
Searching...
No Matches
Token_p.h
1/*
2 * Copyright (c) 2008,2010,2015 Cyrille Berger <cberger@cberger.net>
3 *
4 */
5
6#ifndef _TURTLE_TOKEN_H_
7#define _TURTLE_TOKEN_H_
8
9#include <QString>
10#include <sstream>
11
12#include <knowCore/Curie.h>
13
14namespace knowRDF
15{
16 namespace Turtle
17 {
18 struct Token {
22 enum Type {
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,
37 QUESTION,
40 // Constants
41 FLOAT_CONSTANT,
42 INTEGER_CONSTANT,
43 STRING_CONSTANT,
44 URI_CONSTANT,
45 IDENTIFIER,
46 LANG_TAG,
47 CURIE_CONSTANT,
48 // Keywords,
49 BASE,
50 PREFIX,
51 A,
52 TRUE,
53 FALSE,
54 LOAD_FILE
55 };
59 int line;
61 int column;
63 QString string;
64 // Curie
65 knowCore::Curie curie;
66 Token();
67 Token(const knowCore::Curie& _curie, int _line, int _column);
71 Token(Type _type, int _line, int _column);
75 Token(Type _type, const QString& _string, int _line, int _column);
76 static QString typeToString(Type );
77 QString toString() const;
78 };
79 }
80}
81
82
83#endif
Definition Curie.h:22
Definition Token_p.h:18
int column
Column of the token.
Definition Token_p.h:61
int line
line of the token
Definition Token_p.h:59
Type
Definition Token_p.h:22
@ COLON
:
Definition Token_p.h:30
@ ENDBOXBRACKET
]
Definition Token_p.h:36
@ STARTBOXBRACKET
[
Definition Token_p.h:35
@ STARTBRACKET
(
Definition Token_p.h:33
@ SEMI
;
Definition Token_p.h:29
@ UNDERSCORECOLON
< ?
Definition Token_p.h:38
@ DOT
Definition Token_p.h:32
@ CIRCUMFLEXCIRCUMFLEX
^^
Definition Token_p.h:39
@ ENDBRACKET
)
Definition Token_p.h:34
@ COMA
,
Definition Token_p.h:31
Type type
type of the token
Definition Token_p.h:57
QString string
String or identifier name.
Definition Token_p.h:63