libutap  0.93
Uppaal Timed Automata Parser
libparser.h
Go to the documentation of this file.
1 // -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 
3 /* libutap - Uppaal Timed Automata Parser.
4  Copyright (C) 2002 Uppsala University and Aalborg University.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public License
8  as published by the Free Software Foundation; either version 2.1 of
9  the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  USA
20 */
21 
22 #ifndef UTAP_LIBPARSER_HH
23 #define UTAP_LIBPARSER_HH
24 
25 #include <functional>
26 
27 #include "utap/builder.h"
28 
29 // The maximum length is 4000 (see error message) + 1 for the
30 // terminating \0.
31 
32 #define MAXLEN 4001
33 
34 // Here is the (constant) error message.
35 // There is a problem with macros with the mingwin g++ compiler
36 // so whenever the constant is changed we need to change the
37 // string manually too.
38 
39 #define ID_TOO_LONG "$Identifier_is_too_long._Limit_length_is_4000."
40 
41 enum syntax_t { SYNTAX_OLD = (1 << 0),
42  SYNTAX_NEW = (1 << 1),
43  SYNTAX_PROPERTY = (1 << 2),
44  SYNTAX_GUIDING = (1 << 3),
45  SYNTAX_TIGA = (1 << 4),
46  SYNTAX_PROB = (1 << 5)
47 };
48 
49 // Defined in keywords.cc
50 extern bool isKeyword(const char *id, uint32_t syntax);
51 
52 namespace UTAP
53 {
59  {
60  public:
61  static uint32_t line;
62  static uint32_t offset;
63  static uint32_t position;
64  static std::string path;
65 
67  static void reset();
68 
77  static void setPath(ParserBuilder *builder, std::string s);
78 
83  static int increment(ParserBuilder *builder, int n);
84 
89  static void newline(ParserBuilder *builder, int n);
90  };
91 }
92 
93 #endif
static void setPath(ParserBuilder *builder, std::string s)
Sets the current path to s, offset to 0 and line to 1.
Definition: lexer.cc:819
static uint32_t line
Definition: libparser.h:61
Help class used by the lexer, parser and xmlreader to keep track of the current position.
Definition: libparser.h:58
The ParserBuilder interface is used by the parser to output the parsed system.
Definition: builder.h:80
static void reset()
Resets position tracker to position 0.
static syntax_t syntax
Definition: parser.cc:106
static uint32_t offset
Definition: libparser.h:62
static uint32_t position
Definition: libparser.h:63
syntax_t
Definition: libparser.h:41
static void newline(ParserBuilder *builder, int n)
Increments line by n and adds the position to builder.
Definition: lexer.cc:841
static std::string path
Definition: libparser.h:64
Definition: lexer.cc:817
static int increment(ParserBuilder *builder, int n)
Sets the position of builder to [position, position + n) and increments position and offset by n...
Definition: lexer.cc:834
bool isKeyword(const char *id, uint32_t syntax)
Definition: keywords.cc:453