bool 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/bool_ext/ast.c +7 -4
- data/ext/bool_ext/ast.h +5 -2
- data/ext/bool_ext/ext.c +7 -5
- data/ext/bool_ext/extconf.rb +0 -4
- data/ext/bool_ext/lexer.c +1 -2
- data/ext/bool_ext/parser.c +318 -493
- data/ext/bool_ext/parser.h +32 -49
- data/lib/bool.rb +4 -4
- data/lib/bool/ast.rb +3 -3
- metadata +9 -8
data/ext/bool_ext/parser.h
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
/* A Bison parser, made by GNU Bison
|
1
|
+
/* A Bison parser, made by GNU Bison 3.0. */
|
2
2
|
|
3
3
|
/* Bison interface for Yacc-like parsers in C
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
|
5
|
+
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
6
|
+
|
7
7
|
This program is free software: you can redistribute it and/or modify
|
8
8
|
it under the terms of the GNU General Public License as published by
|
9
9
|
the Free Software Foundation, either version 3 of the License, or
|
10
10
|
(at your option) any later version.
|
11
|
-
|
11
|
+
|
12
12
|
This program is distributed in the hope that it will be useful,
|
13
13
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
14
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
15
|
GNU General Public License for more details.
|
16
|
-
|
16
|
+
|
17
17
|
You should have received a copy of the GNU General Public License
|
18
18
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
19
19
|
|
@@ -26,13 +26,13 @@
|
|
26
26
|
special exception, which will cause the skeleton and the resulting
|
27
27
|
Bison output files to be licensed under the GNU General Public
|
28
28
|
License without this special exception.
|
29
|
-
|
29
|
+
|
30
30
|
This special exception was added by the Free Software Foundation in
|
31
31
|
version 2.2 of Bison. */
|
32
32
|
|
33
33
|
#ifndef YY_YY_PARSER_H_INCLUDED
|
34
34
|
# define YY_YY_PARSER_H_INCLUDED
|
35
|
-
/*
|
35
|
+
/* Debug traces. */
|
36
36
|
#ifndef YYDEBUG
|
37
37
|
# define YYDEBUG 0
|
38
38
|
#endif
|
@@ -40,77 +40,60 @@
|
|
40
40
|
extern int yydebug;
|
41
41
|
#endif
|
42
42
|
/* "%code requires" blocks. */
|
43
|
-
|
44
|
-
#line 9 "parser.y"
|
43
|
+
#line 9 "parser.y" /* yacc.c:1915 */
|
45
44
|
|
46
45
|
#include "ast.h"
|
47
46
|
|
47
|
+
#line 48 "parser.h" /* yacc.c:1915 */
|
48
48
|
|
49
|
-
/*
|
50
|
-
#line 51 "parser.h"
|
51
|
-
|
52
|
-
/* Tokens. */
|
49
|
+
/* Token type. */
|
53
50
|
#ifndef YYTOKENTYPE
|
54
51
|
# define YYTOKENTYPE
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
};
|
52
|
+
enum yytokentype
|
53
|
+
{
|
54
|
+
TOKEN_VAR = 258,
|
55
|
+
TOKEN_AND = 259,
|
56
|
+
TOKEN_OR = 260,
|
57
|
+
TOKEN_NOT = 261,
|
58
|
+
TOKEN_LPAREN = 262,
|
59
|
+
TOKEN_RPAREN = 263,
|
60
|
+
UNOT = 264
|
61
|
+
};
|
66
62
|
#endif
|
67
63
|
|
68
|
-
|
64
|
+
/* Value type. */
|
69
65
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
70
|
-
typedef union YYSTYPE
|
66
|
+
typedef union YYSTYPE YYSTYPE;
|
67
|
+
union YYSTYPE
|
71
68
|
{
|
72
|
-
|
73
|
-
#line 21 "parser.y"
|
69
|
+
#line 21 "parser.y" /* yacc.c:1915 */
|
74
70
|
|
75
71
|
Token* token;
|
76
72
|
Node* node;
|
77
73
|
|
78
|
-
|
79
|
-
|
80
|
-
#line 81 "parser.h"
|
81
|
-
} YYSTYPE;
|
74
|
+
#line 75 "parser.h" /* yacc.c:1915 */
|
75
|
+
};
|
82
76
|
# define YYSTYPE_IS_TRIVIAL 1
|
83
|
-
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
84
77
|
# define YYSTYPE_IS_DECLARED 1
|
85
78
|
#endif
|
86
79
|
|
80
|
+
/* Location type. */
|
87
81
|
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
88
|
-
typedef struct YYLTYPE
|
82
|
+
typedef struct YYLTYPE YYLTYPE;
|
83
|
+
struct YYLTYPE
|
89
84
|
{
|
90
85
|
int first_line;
|
91
86
|
int first_column;
|
92
87
|
int last_line;
|
93
88
|
int last_column;
|
94
|
-
}
|
95
|
-
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
89
|
+
};
|
96
90
|
# define YYLTYPE_IS_DECLARED 1
|
97
91
|
# define YYLTYPE_IS_TRIVIAL 1
|
98
92
|
#endif
|
99
93
|
|
94
|
+
|
100
95
|
extern YYSTYPE yylval;
|
101
96
|
extern YYLTYPE yylloc;
|
102
|
-
#ifdef YYPARSE_PARAM
|
103
|
-
#if defined __STDC__ || defined __cplusplus
|
104
|
-
int yyparse (void *YYPARSE_PARAM);
|
105
|
-
#else
|
106
|
-
int yyparse ();
|
107
|
-
#endif
|
108
|
-
#else /* ! YYPARSE_PARAM */
|
109
|
-
#if defined __STDC__ || defined __cplusplus
|
110
97
|
int yyparse (Node** node);
|
111
|
-
#else
|
112
|
-
int yyparse ();
|
113
|
-
#endif
|
114
|
-
#endif /* ! YYPARSE_PARAM */
|
115
98
|
|
116
99
|
#endif /* !YY_YY_PARSER_H_INCLUDED */
|
data/lib/bool.rb
CHANGED
@@ -7,11 +7,11 @@ require 'bool/renderer'
|
|
7
7
|
|
8
8
|
module Bool
|
9
9
|
class SyntaxError < StandardError
|
10
|
-
attr_reader :
|
10
|
+
attr_reader :first_line, :first_column, :last_line, :last_column
|
11
11
|
|
12
|
-
def initialize(message,
|
12
|
+
def initialize(message, first_line, first_column, last_line, last_column)
|
13
13
|
super(message)
|
14
|
-
@
|
14
|
+
@first_line, @first_column, @last_line, @last_column = first_line, first_column, last_line, last_column
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -21,7 +21,7 @@ module Bool
|
|
21
21
|
parser = Java::Bool::Parser.new(lexer)
|
22
22
|
parser.buildAst()
|
23
23
|
rescue => e
|
24
|
-
raise SyntaxError.new(e.message, e.
|
24
|
+
raise SyntaxError.new(e.message, e.first_line, e.first_column, e.last_line, e.last_column)
|
25
25
|
end
|
26
26
|
module_function(:parse)
|
27
27
|
else
|
data/lib/bool/ast.rb
CHANGED
@@ -3,10 +3,10 @@ module Bool
|
|
3
3
|
# AST classes defined in bool_ext.jar
|
4
4
|
else
|
5
5
|
class Token
|
6
|
-
attr_reader :value, :first_line, :
|
6
|
+
attr_reader :value, :first_line, :first_column, :last_line, :last_column
|
7
7
|
|
8
|
-
def initialize(value, first_line,
|
9
|
-
@value, @first_line, @
|
8
|
+
def initialize(value, first_line, first_column, last_line, last_column)
|
9
|
+
@value, @first_line, @first_column, @last_line, @last_column = value, first_line, first_column, last_line, last_column
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.3.
|
33
|
+
version: 1.3.5
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.3.
|
40
|
+
version: 1.3.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake-compiler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.9.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.9.1
|
55
55
|
description:
|
56
56
|
email:
|
57
57
|
executables: []
|
@@ -96,3 +96,4 @@ signing_key:
|
|
96
96
|
specification_version: 4
|
97
97
|
summary: Boolean expression evaluator
|
98
98
|
test_files: []
|
99
|
+
has_rdoc:
|