langscan 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.txt +19 -0
- data/History.txt +126 -0
- data/Manifest.txt +167 -0
- data/README.rdoc +89 -0
- data/Rakefile +40 -0
- data/ext/langscan/_make_c.rb +20 -0
- data/ext/langscan/_make_h.rb +30 -0
- data/ext/langscan/_template.c +134 -0
- data/ext/langscan/_template.h +53 -0
- data/ext/langscan/c/c/Makefile +157 -0
- data/ext/langscan/c/c/c.c +134 -0
- data/ext/langscan/c/c/c.h +66 -0
- data/ext/langscan/c/c/ctok.c +4622 -0
- data/ext/langscan/c/c/ctok.l +212 -0
- data/ext/langscan/c/c/extconf.rb +3 -0
- data/ext/langscan/c/c/modulename.txt +1 -0
- data/ext/langscan/c/c/tokenlist.txt +13 -0
- data/ext/langscan/csharp/csharp/Makefile +157 -0
- data/ext/langscan/csharp/csharp/csharp.c +134 -0
- data/ext/langscan/csharp/csharp/csharp.h +65 -0
- data/ext/langscan/csharp/csharp/csharptok.c +2965 -0
- data/ext/langscan/csharp/csharp/csharptok.l +200 -0
- data/ext/langscan/csharp/csharp/extconf.rb +3 -0
- data/ext/langscan/csharp/csharp/modulename.txt +1 -0
- data/ext/langscan/csharp/csharp/tokenlist.txt +12 -0
- data/ext/langscan/d/d/Makefile +157 -0
- data/ext/langscan/d/d/d.c +134 -0
- data/ext/langscan/d/d/d.h +64 -0
- data/ext/langscan/d/d/dtok.c +5461 -0
- data/ext/langscan/d/d/dtok.l +282 -0
- data/ext/langscan/d/d/extconf.rb +3 -0
- data/ext/langscan/d/d/modulename.txt +1 -0
- data/ext/langscan/d/d/tokenlist.txt +11 -0
- data/ext/langscan/elisp/elisp/Makefile +157 -0
- data/ext/langscan/elisp/elisp/elisp.c +134 -0
- data/ext/langscan/elisp/elisp/elisp.h +62 -0
- data/ext/langscan/elisp/elisp/elisptok.c +2101 -0
- data/ext/langscan/elisp/elisp/elisptok.l +151 -0
- data/ext/langscan/elisp/elisp/extconf.rb +3 -0
- data/ext/langscan/elisp/elisp/modulename.txt +1 -0
- data/ext/langscan/elisp/elisp/tokenlist.txt +9 -0
- data/ext/langscan/java/java/Makefile +157 -0
- data/ext/langscan/java/java/extconf.rb +3 -0
- data/ext/langscan/java/java/java.c +134 -0
- data/ext/langscan/java/java/java.h +64 -0
- data/ext/langscan/java/java/javatok.c +2090 -0
- data/ext/langscan/java/java/javatok.l +155 -0
- data/ext/langscan/java/java/modulename.txt +1 -0
- data/ext/langscan/java/java/tokenlist.txt +11 -0
- data/ext/langscan/javascript/javascript/Makefile +157 -0
- data/ext/langscan/javascript/javascript/extconf.rb +3 -0
- data/ext/langscan/javascript/javascript/javascript.c +134 -0
- data/ext/langscan/javascript/javascript/javascript.h +63 -0
- data/ext/langscan/javascript/javascript/javascripttok.c +2051 -0
- data/ext/langscan/javascript/javascript/javascripttok.l +147 -0
- data/ext/langscan/javascript/javascript/modulename.txt +1 -0
- data/ext/langscan/javascript/javascript/tokenlist.txt +10 -0
- data/ext/langscan/pairmatcher/pairmatcher/Makefile +157 -0
- data/ext/langscan/pairmatcher/pairmatcher/extconf.rb +3 -0
- data/ext/langscan/pairmatcher/pairmatcher/pairmatcher.c +890 -0
- data/ext/langscan/php/php/Makefile +157 -0
- data/ext/langscan/php/php/extconf.rb +3 -0
- data/ext/langscan/php/php/modulename.txt +1 -0
- data/ext/langscan/php/php/php.c +134 -0
- data/ext/langscan/php/php/php.h +64 -0
- data/ext/langscan/php/php/phptok.c +2406 -0
- data/ext/langscan/php/php/phptok.l +212 -0
- data/ext/langscan/php/php/tokenlist.txt +11 -0
- data/ext/langscan/post-distclean.rb +21 -0
- data/ext/langscan/pre-config.rb +57 -0
- data/ext/langscan/python/python/Makefile +157 -0
- data/ext/langscan/python/python/extconf.rb +3 -0
- data/ext/langscan/python/python/modulename.txt +1 -0
- data/ext/langscan/python/python/python.c +134 -0
- data/ext/langscan/python/python/python.h +61 -0
- data/ext/langscan/python/python/pythontok.c +2102 -0
- data/ext/langscan/python/python/pythontok.l +155 -0
- data/ext/langscan/python/python/tokenlist.txt +8 -0
- data/ext/langscan/ruby/compat/ripper/Makefile +158 -0
- data/ext/langscan/ruby/compat/ripper/depend +1 -0
- data/ext/langscan/ruby/compat/ripper/extconf.rb +4 -0
- data/ext/langscan/ruby/compat/ripper/include/eventids1.c +251 -0
- data/ext/langscan/ruby/compat/ripper/include/eventids2.c +277 -0
- data/ext/langscan/ruby/compat/ripper/include/lex.c +138 -0
- data/ext/langscan/ruby/compat/ripper/ripper.c +14420 -0
- data/ext/langscan/scheme/scheme/Makefile +157 -0
- data/ext/langscan/scheme/scheme/extconf.rb +3 -0
- data/ext/langscan/scheme/scheme/modulename.txt +1 -0
- data/ext/langscan/scheme/scheme/scheme.c +134 -0
- data/ext/langscan/scheme/scheme/scheme.h +60 -0
- data/ext/langscan/scheme/scheme/schemetok.c +2447 -0
- data/ext/langscan/scheme/scheme/schemetok.l +177 -0
- data/ext/langscan/scheme/scheme/tokenlist.txt +7 -0
- data/ext/langscan/sh/sh/Makefile +157 -0
- data/ext/langscan/sh/sh/extconf.rb +3 -0
- data/ext/langscan/sh/sh/modulename.txt +1 -0
- data/ext/langscan/sh/sh/sh.c +134 -0
- data/ext/langscan/sh/sh/sh.h +61 -0
- data/ext/langscan/sh/sh/shtok.c +2470 -0
- data/ext/langscan/sh/sh/shtok.l +325 -0
- data/ext/langscan/sh/sh/tokenlist.txt +8 -0
- data/lib/langscan.rb +124 -0
- data/lib/langscan/_common.rb +50 -0
- data/lib/langscan/_easyscanner.rb +78 -0
- data/lib/langscan/_pairmatcher.rb +46 -0
- data/lib/langscan/_type.rb +125 -0
- data/lib/langscan/autoconf.rb +51 -0
- data/lib/langscan/automake.rb +51 -0
- data/lib/langscan/brainfuck.rb +48 -0
- data/lib/langscan/c.rb +144 -0
- data/lib/langscan/csharp.rb +101 -0
- data/lib/langscan/css.rb +109 -0
- data/lib/langscan/d.rb +201 -0
- data/lib/langscan/eiffel.rb +167 -0
- data/lib/langscan/elisp.rb +132 -0
- data/lib/langscan/io.rb +84 -0
- data/lib/langscan/java.rb +95 -0
- data/lib/langscan/javascript.rb +97 -0
- data/lib/langscan/lua.rb +116 -0
- data/lib/langscan/ocaml.rb +298 -0
- data/lib/langscan/ocaml/camlexer.ml +28 -0
- data/lib/langscan/ocaml/lexer.mll +230 -0
- data/lib/langscan/ocaml/types.ml +36 -0
- data/lib/langscan/perl.rb +87 -0
- data/lib/langscan/perl/tokenizer.pl +231 -0
- data/lib/langscan/php.rb +80 -0
- data/lib/langscan/python.rb +101 -0
- data/lib/langscan/rpmspec.rb +71 -0
- data/lib/langscan/ruby.rb +164 -0
- data/lib/langscan/ruby/compat/README +5 -0
- data/lib/langscan/ruby/compat/ripper.rb +4 -0
- data/lib/langscan/ruby/compat/ripper/core.rb +918 -0
- data/lib/langscan/ruby/compat/ripper/filter.rb +70 -0
- data/lib/langscan/ruby/compat/ripper/lexer.rb +179 -0
- data/lib/langscan/ruby/compat/ripper/sexp.rb +100 -0
- data/lib/langscan/scheme.rb +160 -0
- data/lib/langscan/sh.rb +116 -0
- data/lib/langscan/text.rb +37 -0
- data/metaconfig +2 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/makemanifest.rb +21 -0
- data/setup.rb +1604 -0
- data/tasks/extconf.rake +13 -0
- data/tasks/extconf/langscan.rake +42 -0
- data/test/langscan/brainfuck/test/test_scan.rb +55 -0
- data/test/langscan/c/test/test_scan.rb +216 -0
- data/test/langscan/c/test/test_token.rb +41 -0
- data/test/langscan/csharp/test/test_scan.rb +157 -0
- data/test/langscan/css/test/test_css.rb +79 -0
- data/test/langscan/d/test/test_scan.rb +233 -0
- data/test/langscan/d/test/test_token.rb +205 -0
- data/test/langscan/eiffel/test/test_eiffel.rb +95 -0
- data/test/langscan/elisp/test/test_elisp.rb +177 -0
- data/test/langscan/io/test/test_io.rb +79 -0
- data/test/langscan/java/test/test_java.rb +74 -0
- data/test/langscan/javascript/test/test_javascript.rb +39 -0
- data/test/langscan/lua/test/test_lua.rb +69 -0
- data/test/langscan/ocaml/test/test_ocaml.rb +161 -0
- data/test/langscan/php/test/test_scan.rb +138 -0
- data/test/langscan/python/test/test_scan.rb +105 -0
- data/test/langscan/rpmspec/test/test_rpmspec.rb +51 -0
- data/test/langscan/ruby/test/test_scan.rb +71 -0
- data/test/langscan/scheme/test/test_scan.rb +198 -0
- data/test/test_helper.rb +7 -0
- data/test/test_langscan.rb +123 -0
- metadata +296 -0
@@ -0,0 +1,157 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = /Users/osuka/devel/git/langscan/ext/langscan/php/php
|
7
|
+
topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
+
exec_prefix = $(prefix)
|
11
|
+
prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
|
12
|
+
sharedstatedir = $(prefix)/com
|
13
|
+
mandir = $(DESTDIR)/usr/share/man
|
14
|
+
psdir = $(docdir)
|
15
|
+
oldincludedir = $(DESTDIR)/usr/include
|
16
|
+
localedir = $(datarootdir)/locale
|
17
|
+
bindir = $(exec_prefix)/bin
|
18
|
+
libexecdir = $(exec_prefix)/libexec
|
19
|
+
sitedir = $(DESTDIR)/Library/Ruby/Site
|
20
|
+
htmldir = $(docdir)
|
21
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
22
|
+
includedir = $(prefix)/include
|
23
|
+
infodir = $(DESTDIR)/usr/share/info
|
24
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
25
|
+
sysconfdir = $(prefix)/etc
|
26
|
+
libdir = $(exec_prefix)/lib
|
27
|
+
sbindir = $(exec_prefix)/sbin
|
28
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
29
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
30
|
+
dvidir = $(docdir)
|
31
|
+
vendordir = $(libdir)/ruby/vendor_ruby
|
32
|
+
datarootdir = $(prefix)/share
|
33
|
+
pdfdir = $(docdir)
|
34
|
+
archdir = $(rubylibdir)/$(arch)
|
35
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
36
|
+
datadir = $(datarootdir)
|
37
|
+
localstatedir = $(prefix)/var
|
38
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
39
|
+
|
40
|
+
CC = gcc
|
41
|
+
LIBRUBY = $(LIBRUBY_SO)
|
42
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
43
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
44
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
|
45
|
+
|
46
|
+
RUBY_EXTCONF_H =
|
47
|
+
CFLAGS = -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common $(cflags)
|
48
|
+
INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
|
49
|
+
DEFS =
|
50
|
+
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
|
51
|
+
CXXFLAGS = $(CFLAGS)
|
52
|
+
ldflags = -L. -arch i386 -arch x86_64
|
53
|
+
dldflags =
|
54
|
+
archflag =
|
55
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
56
|
+
LDSHARED = cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup
|
57
|
+
AR = ar
|
58
|
+
EXEEXT =
|
59
|
+
|
60
|
+
RUBY_INSTALL_NAME = ruby
|
61
|
+
RUBY_SO_NAME = ruby
|
62
|
+
arch = universal-darwin10.0
|
63
|
+
sitearch = universal-darwin10.0
|
64
|
+
ruby_version = 1.8
|
65
|
+
ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
|
66
|
+
RUBY = $(ruby)
|
67
|
+
RM = rm -f
|
68
|
+
MAKEDIRS = mkdir -p
|
69
|
+
INSTALL = /usr/bin/install -c
|
70
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
71
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
72
|
+
COPY = cp
|
73
|
+
|
74
|
+
#### End of system configuration section. ####
|
75
|
+
|
76
|
+
preload =
|
77
|
+
|
78
|
+
libpath = . $(libdir)
|
79
|
+
LIBPATH = -L. -L$(libdir)
|
80
|
+
DEFFILE =
|
81
|
+
|
82
|
+
CLEANFILES = mkmf.log
|
83
|
+
DISTCLEANFILES =
|
84
|
+
|
85
|
+
extout =
|
86
|
+
extout_prefix =
|
87
|
+
target_prefix = /langscan/php
|
88
|
+
LOCAL_LIBS =
|
89
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl
|
90
|
+
SRCS = php.c phptok.c
|
91
|
+
OBJS = php.o phptok.o
|
92
|
+
TARGET = php
|
93
|
+
DLLIB = $(TARGET).bundle
|
94
|
+
EXTSTATIC =
|
95
|
+
STATIC_LIB =
|
96
|
+
|
97
|
+
BINDIR = $(bindir)
|
98
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
99
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
100
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
101
|
+
|
102
|
+
TARGET_SO = $(DLLIB)
|
103
|
+
CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
|
104
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
105
|
+
|
106
|
+
all: $(DLLIB)
|
107
|
+
static: $(STATIC_LIB)
|
108
|
+
|
109
|
+
clean:
|
110
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
111
|
+
|
112
|
+
distclean: clean
|
113
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
114
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
115
|
+
|
116
|
+
realclean: distclean
|
117
|
+
install: install-so install-rb
|
118
|
+
|
119
|
+
install-so: $(RUBYARCHDIR)
|
120
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
121
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
122
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
123
|
+
install-rb: pre-install-rb install-rb-default
|
124
|
+
install-rb-default: pre-install-rb-default
|
125
|
+
pre-install-rb: Makefile
|
126
|
+
pre-install-rb-default: Makefile
|
127
|
+
$(RUBYARCHDIR):
|
128
|
+
$(MAKEDIRS) $@
|
129
|
+
|
130
|
+
site-install: site-install-so site-install-rb
|
131
|
+
site-install-so: install-so
|
132
|
+
site-install-rb: install-rb
|
133
|
+
|
134
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
135
|
+
|
136
|
+
.cc.o:
|
137
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
138
|
+
|
139
|
+
.cxx.o:
|
140
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
141
|
+
|
142
|
+
.cpp.o:
|
143
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
144
|
+
|
145
|
+
.C.o:
|
146
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
147
|
+
|
148
|
+
.c.o:
|
149
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
150
|
+
|
151
|
+
$(DLLIB): $(OBJS) Makefile
|
152
|
+
@-$(RM) $@
|
153
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
$(OBJS): ruby.h defines.h
|
@@ -0,0 +1 @@
|
|
1
|
+
PHP
|
@@ -0,0 +1,134 @@
|
|
1
|
+
/* -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2 c-style: "BSD" -*- */
|
2
|
+
/*
|
3
|
+
* _template.c - a template file for LangScan modules
|
4
|
+
*
|
5
|
+
* Copyright (C) 2004-2005 Akira Tanaka <akr@m17n.org>
|
6
|
+
* All rights reserved.
|
7
|
+
* This is free software with ABSOLUTELY NO WARRANTY.
|
8
|
+
*
|
9
|
+
* You can redistribute it and/or modify it under the terms of
|
10
|
+
* the GNU General Public License version 2.
|
11
|
+
*/
|
12
|
+
|
13
|
+
|
14
|
+
#include <ruby.h>
|
15
|
+
#include "php.h"
|
16
|
+
|
17
|
+
static VALUE token_symbol_list[
|
18
|
+
#define LANGSCAN_PHP_TOKEN(token) 1 +
|
19
|
+
1 + LANGSCAN_PHP_TOKEN_LIST 0
|
20
|
+
#undef LANGSCAN_PHP_TOKEN
|
21
|
+
];
|
22
|
+
|
23
|
+
#ifndef RSTRING_PTR
|
24
|
+
# define RSTRING_PTR(str) (RSTRING(str)->ptr)
|
25
|
+
#endif
|
26
|
+
#ifndef RSTRING_LEN
|
27
|
+
# define RSTRING_LEN(str) (RSTRING(str)->len)
|
28
|
+
#endif
|
29
|
+
|
30
|
+
#ifndef RARRAY_PTR
|
31
|
+
# define RARRAY_PTR(str) (RARRAY(str)->ptr)
|
32
|
+
#endif
|
33
|
+
#ifndef RARRAY_LEN
|
34
|
+
# define RARRAY_LEN(str) (RARRAY(str)->len)
|
35
|
+
#endif
|
36
|
+
|
37
|
+
static size_t user_read_str(void **user_data_p, char *buf, size_t maxlen)
|
38
|
+
{
|
39
|
+
VALUE user_data = (VALUE)*user_data_p;
|
40
|
+
VALUE user_str = RARRAY_PTR(user_data)[0];
|
41
|
+
VALUE user_off = RARRAY_PTR(user_data)[1];
|
42
|
+
long off = NUM2LONG(user_off);
|
43
|
+
if (RSTRING_LEN(user_str)-off < maxlen) {
|
44
|
+
maxlen = RSTRING_LEN(user_str)-off;
|
45
|
+
}
|
46
|
+
memcpy(buf, RSTRING_PTR(user_str)+off, maxlen);
|
47
|
+
RARRAY_PTR(user_data)[1] = LONG2NUM(off+maxlen);
|
48
|
+
return maxlen;
|
49
|
+
}
|
50
|
+
|
51
|
+
static void tokenizer_mark(langscan_php_tokenizer_t *tokenizer)
|
52
|
+
{
|
53
|
+
if (tokenizer == NULL)
|
54
|
+
return;
|
55
|
+
rb_gc_mark((VALUE)langscan_php_tokenizer_get_user_data(tokenizer));
|
56
|
+
}
|
57
|
+
|
58
|
+
static void tokenizer_free(langscan_php_tokenizer_t *tokenizer)
|
59
|
+
{
|
60
|
+
if (tokenizer == NULL)
|
61
|
+
return;
|
62
|
+
langscan_php_free_tokenizer(tokenizer);
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE tokenizer_s_allocate(VALUE klass)
|
66
|
+
{
|
67
|
+
return Data_Wrap_Struct(klass, tokenizer_mark, tokenizer_free, NULL);
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE tokenizer_initialize(VALUE self, VALUE user_data)
|
71
|
+
{
|
72
|
+
VALUE tmp;
|
73
|
+
user_read_t user_read;
|
74
|
+
langscan_php_tokenizer_t *tokenizer;
|
75
|
+
Data_Get_Struct(self, langscan_php_tokenizer_t, tokenizer);
|
76
|
+
StringValue(user_data);
|
77
|
+
user_read = user_read_str;
|
78
|
+
user_data = rb_ary_new3(2, rb_str_new4(user_data), INT2FIX(0));
|
79
|
+
RBASIC(user_data)->klass = 0;
|
80
|
+
DATA_PTR(self) = langscan_php_make_tokenizer(user_read, (void *)user_data);
|
81
|
+
return self;
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE tokenizer_get_token(VALUE self)
|
85
|
+
{
|
86
|
+
langscan_php_tokenizer_t *tokenizer;
|
87
|
+
langscan_php_token_t token;
|
88
|
+
Data_Get_Struct(self, langscan_php_tokenizer_t, tokenizer);
|
89
|
+
if (tokenizer == NULL) { return Qnil; }
|
90
|
+
token = langscan_php_get_token(tokenizer);
|
91
|
+
if (token == langscan_php_eof) {
|
92
|
+
DATA_PTR(self) = NULL;
|
93
|
+
langscan_php_free_tokenizer(tokenizer);
|
94
|
+
return Qnil;
|
95
|
+
}
|
96
|
+
return rb_ary_new3(8,
|
97
|
+
token_symbol_list[token],
|
98
|
+
rb_str_new(langscan_php_curtoken_text(tokenizer), langscan_php_curtoken_leng(tokenizer)),
|
99
|
+
INT2NUM(langscan_php_curtoken_beg_lineno(tokenizer)),
|
100
|
+
INT2NUM(langscan_php_curtoken_beg_columnno(tokenizer)),
|
101
|
+
INT2NUM(langscan_php_curtoken_beg_byteno(tokenizer)),
|
102
|
+
INT2NUM(langscan_php_curtoken_end_lineno(tokenizer)),
|
103
|
+
INT2NUM(langscan_php_curtoken_end_columnno(tokenizer)),
|
104
|
+
INT2NUM(langscan_php_curtoken_end_byteno(tokenizer)));
|
105
|
+
}
|
106
|
+
|
107
|
+
static VALUE tokenizer_close(VALUE self)
|
108
|
+
{
|
109
|
+
langscan_php_tokenizer_t *tokenizer;
|
110
|
+
Data_Get_Struct(self, langscan_php_tokenizer_t, tokenizer);
|
111
|
+
if (tokenizer == NULL) { return Qnil; }
|
112
|
+
DATA_PTR(self) = NULL;
|
113
|
+
langscan_php_free_tokenizer(tokenizer);
|
114
|
+
return Qnil;
|
115
|
+
}
|
116
|
+
|
117
|
+
void Init_php()
|
118
|
+
{
|
119
|
+
VALUE LangScan = rb_define_module("LangScan");
|
120
|
+
VALUE LangScan_PHP = rb_define_module_under(LangScan, "PHP");
|
121
|
+
VALUE Tokenizer = rb_define_class_under(LangScan_PHP, "Tokenizer", rb_cData);
|
122
|
+
langscan_php_token_t token_id;
|
123
|
+
|
124
|
+
token_id = 0;
|
125
|
+
token_symbol_list[token_id++] = Qnil;
|
126
|
+
#define LANGSCAN_PHP_TOKEN(token) token_symbol_list[token_id++] = ID2SYM(rb_intern(#token));
|
127
|
+
LANGSCAN_PHP_TOKEN_LIST
|
128
|
+
#undef LANGSCAN_PHP_TOKEN
|
129
|
+
|
130
|
+
rb_define_alloc_func(Tokenizer, tokenizer_s_allocate);
|
131
|
+
rb_define_method(Tokenizer, "initialize", tokenizer_initialize, 1);
|
132
|
+
rb_define_method(Tokenizer, "get_token", tokenizer_get_token, 0);
|
133
|
+
rb_define_method(Tokenizer, "close", tokenizer_close, 0);
|
134
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#ifndef LANGSCAN_PHP_H
|
2
|
+
#define LANGSCAN_PHP_H
|
3
|
+
|
4
|
+
#define LANGSCAN_PHP_TOKEN_LIST \
|
5
|
+
LANGSCAN_PHP_TOKEN(integer) \
|
6
|
+
LANGSCAN_PHP_TOKEN(floating) \
|
7
|
+
LANGSCAN_PHP_TOKEN(string) \
|
8
|
+
LANGSCAN_PHP_TOKEN(ident) \
|
9
|
+
LANGSCAN_PHP_TOKEN(keyword) \
|
10
|
+
LANGSCAN_PHP_TOKEN(fundef) \
|
11
|
+
LANGSCAN_PHP_TOKEN(funcall) \
|
12
|
+
LANGSCAN_PHP_TOKEN(classdef) \
|
13
|
+
LANGSCAN_PHP_TOKEN(punct) \
|
14
|
+
LANGSCAN_PHP_TOKEN(comment) \
|
15
|
+
LANGSCAN_PHP_TOKEN(space)
|
16
|
+
|
17
|
+
typedef enum {
|
18
|
+
langscan_php_eof = 0,
|
19
|
+
#define LANGSCAN_PHP_TOKEN(name) langscan_php_##name,
|
20
|
+
LANGSCAN_PHP_TOKEN_LIST
|
21
|
+
#undef LANGSCAN_PHP_TOKEN
|
22
|
+
} langscan_php_token_t;
|
23
|
+
|
24
|
+
typedef struct {
|
25
|
+
int beg_lineno;
|
26
|
+
int beg_columnno;
|
27
|
+
int beg_byteno;
|
28
|
+
int end_lineno;
|
29
|
+
int end_columnno;
|
30
|
+
int end_byteno;
|
31
|
+
int eof;
|
32
|
+
char *text;
|
33
|
+
int leng;
|
34
|
+
size_t (*user_read)(void **user_data_p, char *buf, size_t maxlen);
|
35
|
+
void *user_data;
|
36
|
+
} langscan_php_lex_extra_t;
|
37
|
+
|
38
|
+
typedef struct langscan_php_tokenizer_tag {
|
39
|
+
langscan_php_lex_extra_t *extra;
|
40
|
+
void *scanner;
|
41
|
+
} langscan_php_tokenizer_t;
|
42
|
+
|
43
|
+
typedef size_t (*user_read_t)(void **user_data_p, char *buf, size_t maxlen);
|
44
|
+
|
45
|
+
langscan_php_tokenizer_t *langscan_php_make_tokenizer(user_read_t user_read, void *user_data);
|
46
|
+
langscan_php_token_t langscan_php_get_token(langscan_php_tokenizer_t *tokenizer);
|
47
|
+
void langscan_php_free_tokenizer(langscan_php_tokenizer_t *tokenizer);
|
48
|
+
|
49
|
+
user_read_t langscan_php_tokenizer_get_user_read(langscan_php_tokenizer_t *tokenizer);
|
50
|
+
void *langscan_php_tokenizer_get_user_data(langscan_php_tokenizer_t *tokenizer);
|
51
|
+
|
52
|
+
const char *langscan_php_token_name(langscan_php_token_t token);
|
53
|
+
#define langscan_php_curtoken_beg_lineno(tokenizer) ((tokenizer)->extra->beg_lineno)
|
54
|
+
#define langscan_php_curtoken_beg_columnno(tokenizer) ((tokenizer)->extra->beg_columnno)
|
55
|
+
#define langscan_php_curtoken_beg_byteno(tokenizer) ((tokenizer)->extra->beg_byteno)
|
56
|
+
#define langscan_php_curtoken_end_lineno(tokenizer) ((tokenizer)->extra->end_lineno)
|
57
|
+
#define langscan_php_curtoken_end_columnno(tokenizer) ((tokenizer)->extra->end_columnno)
|
58
|
+
#define langscan_php_curtoken_end_byteno(tokenizer) ((tokenizer)->extra->end_byteno)
|
59
|
+
#define langscan_php_curtoken_text(tokenizer) ((tokenizer)->extra->text)
|
60
|
+
#define langscan_php_curtoken_leng(tokenizer) ((tokenizer)->extra->leng)
|
61
|
+
|
62
|
+
void langscan_php_extract_functions(langscan_php_tokenizer_t *);
|
63
|
+
|
64
|
+
#endif
|
@@ -0,0 +1,2406 @@
|
|
1
|
+
|
2
|
+
#line 3 "<stdout>"
|
3
|
+
|
4
|
+
#define YY_INT_ALIGNED short int
|
5
|
+
|
6
|
+
/* A lexical scanner generated by flex */
|
7
|
+
|
8
|
+
#define FLEX_SCANNER
|
9
|
+
#define YY_FLEX_MAJOR_VERSION 2
|
10
|
+
#define YY_FLEX_MINOR_VERSION 5
|
11
|
+
#define YY_FLEX_SUBMINOR_VERSION 35
|
12
|
+
#if YY_FLEX_SUBMINOR_VERSION > 0
|
13
|
+
#define FLEX_BETA
|
14
|
+
#endif
|
15
|
+
|
16
|
+
/* First, we deal with platform-specific or compiler-specific issues. */
|
17
|
+
|
18
|
+
/* begin standard C headers. */
|
19
|
+
#include <stdio.h>
|
20
|
+
#include <string.h>
|
21
|
+
#include <errno.h>
|
22
|
+
#include <stdlib.h>
|
23
|
+
|
24
|
+
/* end standard C headers. */
|
25
|
+
|
26
|
+
/* flex integer type definitions */
|
27
|
+
|
28
|
+
#ifndef FLEXINT_H
|
29
|
+
#define FLEXINT_H
|
30
|
+
|
31
|
+
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
32
|
+
|
33
|
+
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
34
|
+
|
35
|
+
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
36
|
+
* if you want the limit (max/min) macros for int types.
|
37
|
+
*/
|
38
|
+
#ifndef __STDC_LIMIT_MACROS
|
39
|
+
#define __STDC_LIMIT_MACROS 1
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#include <inttypes.h>
|
43
|
+
typedef int8_t flex_int8_t;
|
44
|
+
typedef uint8_t flex_uint8_t;
|
45
|
+
typedef int16_t flex_int16_t;
|
46
|
+
typedef uint16_t flex_uint16_t;
|
47
|
+
typedef int32_t flex_int32_t;
|
48
|
+
typedef uint32_t flex_uint32_t;
|
49
|
+
#else
|
50
|
+
typedef signed char flex_int8_t;
|
51
|
+
typedef short int flex_int16_t;
|
52
|
+
typedef int flex_int32_t;
|
53
|
+
typedef unsigned char flex_uint8_t;
|
54
|
+
typedef unsigned short int flex_uint16_t;
|
55
|
+
typedef unsigned int flex_uint32_t;
|
56
|
+
#endif /* ! C99 */
|
57
|
+
|
58
|
+
/* Limits of integral types. */
|
59
|
+
#ifndef INT8_MIN
|
60
|
+
#define INT8_MIN (-128)
|
61
|
+
#endif
|
62
|
+
#ifndef INT16_MIN
|
63
|
+
#define INT16_MIN (-32767-1)
|
64
|
+
#endif
|
65
|
+
#ifndef INT32_MIN
|
66
|
+
#define INT32_MIN (-2147483647-1)
|
67
|
+
#endif
|
68
|
+
#ifndef INT8_MAX
|
69
|
+
#define INT8_MAX (127)
|
70
|
+
#endif
|
71
|
+
#ifndef INT16_MAX
|
72
|
+
#define INT16_MAX (32767)
|
73
|
+
#endif
|
74
|
+
#ifndef INT32_MAX
|
75
|
+
#define INT32_MAX (2147483647)
|
76
|
+
#endif
|
77
|
+
#ifndef UINT8_MAX
|
78
|
+
#define UINT8_MAX (255U)
|
79
|
+
#endif
|
80
|
+
#ifndef UINT16_MAX
|
81
|
+
#define UINT16_MAX (65535U)
|
82
|
+
#endif
|
83
|
+
#ifndef UINT32_MAX
|
84
|
+
#define UINT32_MAX (4294967295U)
|
85
|
+
#endif
|
86
|
+
|
87
|
+
#endif /* ! FLEXINT_H */
|
88
|
+
|
89
|
+
#ifdef __cplusplus
|
90
|
+
|
91
|
+
/* The "const" storage-class-modifier is valid. */
|
92
|
+
#define YY_USE_CONST
|
93
|
+
|
94
|
+
#else /* ! __cplusplus */
|
95
|
+
|
96
|
+
/* C99 requires __STDC__ to be defined as 1. */
|
97
|
+
#if defined (__STDC__)
|
98
|
+
|
99
|
+
#define YY_USE_CONST
|
100
|
+
|
101
|
+
#endif /* defined (__STDC__) */
|
102
|
+
#endif /* ! __cplusplus */
|
103
|
+
|
104
|
+
#ifdef YY_USE_CONST
|
105
|
+
#define yyconst const
|
106
|
+
#else
|
107
|
+
#define yyconst
|
108
|
+
#endif
|
109
|
+
|
110
|
+
/* Returned upon end-of-file. */
|
111
|
+
#define YY_NULL 0
|
112
|
+
|
113
|
+
/* Promotes a possibly negative, possibly signed char to an unsigned
|
114
|
+
* integer for use as an array index. If the signed char is negative,
|
115
|
+
* we want to instead treat it as an 8-bit unsigned char, hence the
|
116
|
+
* double cast.
|
117
|
+
*/
|
118
|
+
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
|
119
|
+
|
120
|
+
/* An opaque pointer. */
|
121
|
+
#ifndef YY_TYPEDEF_YY_SCANNER_T
|
122
|
+
#define YY_TYPEDEF_YY_SCANNER_T
|
123
|
+
typedef void* yyscan_t;
|
124
|
+
#endif
|
125
|
+
|
126
|
+
/* For convenience, these vars (plus the bison vars far below)
|
127
|
+
are macros in the reentrant scanner. */
|
128
|
+
#define yyin yyg->yyin_r
|
129
|
+
#define yyout yyg->yyout_r
|
130
|
+
#define yyextra yyg->yyextra_r
|
131
|
+
#define yyleng yyg->yyleng_r
|
132
|
+
#define yytext yyg->yytext_r
|
133
|
+
#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
|
134
|
+
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
|
135
|
+
#define yy_flex_debug yyg->yy_flex_debug_r
|
136
|
+
|
137
|
+
/* Enter a start condition. This macro really ought to take a parameter,
|
138
|
+
* but we do it the disgusting crufty way forced on us by the ()-less
|
139
|
+
* definition of BEGIN.
|
140
|
+
*/
|
141
|
+
#define BEGIN yyg->yy_start = 1 + 2 *
|
142
|
+
|
143
|
+
/* Translate the current start state into a value that can be later handed
|
144
|
+
* to BEGIN to return to the state. The YYSTATE alias is for lex
|
145
|
+
* compatibility.
|
146
|
+
*/
|
147
|
+
#define YY_START ((yyg->yy_start - 1) / 2)
|
148
|
+
#define YYSTATE YY_START
|
149
|
+
|
150
|
+
/* Action number for EOF rule of a given start state. */
|
151
|
+
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
|
152
|
+
|
153
|
+
/* Special action meaning "start processing a new file". */
|
154
|
+
#define YY_NEW_FILE langscan_php_lex_restart(yyin ,yyscanner )
|
155
|
+
|
156
|
+
#define YY_END_OF_BUFFER_CHAR 0
|
157
|
+
|
158
|
+
/* Size of default input buffer. */
|
159
|
+
#ifndef YY_BUF_SIZE
|
160
|
+
#define YY_BUF_SIZE 16384
|
161
|
+
#endif
|
162
|
+
|
163
|
+
/* The state buf must be large enough to hold one state per character in the main buffer.
|
164
|
+
*/
|
165
|
+
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
|
166
|
+
|
167
|
+
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
168
|
+
#define YY_TYPEDEF_YY_BUFFER_STATE
|
169
|
+
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
170
|
+
#endif
|
171
|
+
|
172
|
+
#ifndef YY_TYPEDEF_YY_SIZE_T
|
173
|
+
#define YY_TYPEDEF_YY_SIZE_T
|
174
|
+
typedef size_t yy_size_t;
|
175
|
+
#endif
|
176
|
+
|
177
|
+
#define EOB_ACT_CONTINUE_SCAN 0
|
178
|
+
#define EOB_ACT_END_OF_FILE 1
|
179
|
+
#define EOB_ACT_LAST_MATCH 2
|
180
|
+
|
181
|
+
#define YY_LESS_LINENO(n)
|
182
|
+
|
183
|
+
/* Return all but the first "n" matched characters back to the input stream. */
|
184
|
+
#define yyless(n) \
|
185
|
+
do \
|
186
|
+
{ \
|
187
|
+
/* Undo effects of setting up yytext. */ \
|
188
|
+
int yyless_macro_arg = (n); \
|
189
|
+
YY_LESS_LINENO(yyless_macro_arg);\
|
190
|
+
*yy_cp = yyg->yy_hold_char; \
|
191
|
+
YY_RESTORE_YY_MORE_OFFSET \
|
192
|
+
yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
|
193
|
+
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
|
194
|
+
} \
|
195
|
+
while ( 0 )
|
196
|
+
|
197
|
+
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
|
198
|
+
|
199
|
+
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
200
|
+
#define YY_STRUCT_YY_BUFFER_STATE
|
201
|
+
struct yy_buffer_state
|
202
|
+
{
|
203
|
+
FILE *yy_input_file;
|
204
|
+
|
205
|
+
char *yy_ch_buf; /* input buffer */
|
206
|
+
char *yy_buf_pos; /* current position in input buffer */
|
207
|
+
|
208
|
+
/* Size of input buffer in bytes, not including room for EOB
|
209
|
+
* characters.
|
210
|
+
*/
|
211
|
+
yy_size_t yy_buf_size;
|
212
|
+
|
213
|
+
/* Number of characters read into yy_ch_buf, not including EOB
|
214
|
+
* characters.
|
215
|
+
*/
|
216
|
+
yy_size_t yy_n_chars;
|
217
|
+
|
218
|
+
/* Whether we "own" the buffer - i.e., we know we created it,
|
219
|
+
* and can realloc() it to grow it, and should free() it to
|
220
|
+
* delete it.
|
221
|
+
*/
|
222
|
+
int yy_is_our_buffer;
|
223
|
+
|
224
|
+
/* Whether this is an "interactive" input source; if so, and
|
225
|
+
* if we're using stdio for input, then we want to use getc()
|
226
|
+
* instead of fread(), to make sure we stop fetching input after
|
227
|
+
* each newline.
|
228
|
+
*/
|
229
|
+
int yy_is_interactive;
|
230
|
+
|
231
|
+
/* Whether we're considered to be at the beginning of a line.
|
232
|
+
* If so, '^' rules will be active on the next match, otherwise
|
233
|
+
* not.
|
234
|
+
*/
|
235
|
+
int yy_at_bol;
|
236
|
+
|
237
|
+
int yy_bs_lineno; /**< The line count. */
|
238
|
+
int yy_bs_column; /**< The column count. */
|
239
|
+
|
240
|
+
/* Whether to try to fill the input buffer when we reach the
|
241
|
+
* end of it.
|
242
|
+
*/
|
243
|
+
int yy_fill_buffer;
|
244
|
+
|
245
|
+
int yy_buffer_status;
|
246
|
+
|
247
|
+
#define YY_BUFFER_NEW 0
|
248
|
+
#define YY_BUFFER_NORMAL 1
|
249
|
+
/* When an EOF's been seen but there's still some text to process
|
250
|
+
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
|
251
|
+
* shouldn't try reading from the input source any more. We might
|
252
|
+
* still have a bunch of tokens to match, though, because of
|
253
|
+
* possible backing-up.
|
254
|
+
*
|
255
|
+
* When we actually see the EOF, we change the status to "new"
|
256
|
+
* (via langscan_php_lex_restart()), so that the user can continue scanning by
|
257
|
+
* just pointing yyin at a new input file.
|
258
|
+
*/
|
259
|
+
#define YY_BUFFER_EOF_PENDING 2
|
260
|
+
|
261
|
+
};
|
262
|
+
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
263
|
+
|
264
|
+
/* We provide macros for accessing buffer states in case in the
|
265
|
+
* future we want to put the buffer states in a more general
|
266
|
+
* "scanner state".
|
267
|
+
*
|
268
|
+
* Returns the top of the stack, or NULL.
|
269
|
+
*/
|
270
|
+
#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
|
271
|
+
? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
|
272
|
+
: NULL)
|
273
|
+
|
274
|
+
/* Same as previous macro, but useful when we know that the buffer stack is not
|
275
|
+
* NULL or when we need an lvalue. For internal use only.
|
276
|
+
*/
|
277
|
+
#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
|
278
|
+
|
279
|
+
void langscan_php_lex_restart (FILE *input_file ,yyscan_t yyscanner );
|
280
|
+
void langscan_php_lex__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
|
281
|
+
YY_BUFFER_STATE langscan_php_lex__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
|
282
|
+
void langscan_php_lex__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
|
283
|
+
void langscan_php_lex__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
|
284
|
+
void langscan_php_lex_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
|
285
|
+
void langscan_php_lex_pop_buffer_state (yyscan_t yyscanner );
|
286
|
+
|
287
|
+
static void langscan_php_lex_ensure_buffer_stack (yyscan_t yyscanner );
|
288
|
+
static void langscan_php_lex__load_buffer_state (yyscan_t yyscanner );
|
289
|
+
static void langscan_php_lex__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
|
290
|
+
|
291
|
+
#define YY_FLUSH_BUFFER langscan_php_lex__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
|
292
|
+
|
293
|
+
YY_BUFFER_STATE langscan_php_lex__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
|
294
|
+
YY_BUFFER_STATE langscan_php_lex__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
|
295
|
+
YY_BUFFER_STATE langscan_php_lex__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
|
296
|
+
|
297
|
+
void *langscan_php_lex_alloc (yy_size_t ,yyscan_t yyscanner );
|
298
|
+
void *langscan_php_lex_realloc (void *,yy_size_t ,yyscan_t yyscanner );
|
299
|
+
void langscan_php_lex_free (void * ,yyscan_t yyscanner );
|
300
|
+
|
301
|
+
#define yy_new_buffer langscan_php_lex__create_buffer
|
302
|
+
|
303
|
+
#define yy_set_interactive(is_interactive) \
|
304
|
+
{ \
|
305
|
+
if ( ! YY_CURRENT_BUFFER ){ \
|
306
|
+
langscan_php_lex_ensure_buffer_stack (yyscanner); \
|
307
|
+
YY_CURRENT_BUFFER_LVALUE = \
|
308
|
+
langscan_php_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
|
309
|
+
} \
|
310
|
+
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
|
311
|
+
}
|
312
|
+
|
313
|
+
#define yy_set_bol(at_bol) \
|
314
|
+
{ \
|
315
|
+
if ( ! YY_CURRENT_BUFFER ){\
|
316
|
+
langscan_php_lex_ensure_buffer_stack (yyscanner); \
|
317
|
+
YY_CURRENT_BUFFER_LVALUE = \
|
318
|
+
langscan_php_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
|
319
|
+
} \
|
320
|
+
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
|
321
|
+
}
|
322
|
+
|
323
|
+
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
|
324
|
+
|
325
|
+
/* Begin user sect3 */
|
326
|
+
|
327
|
+
#define langscan_php_lex_wrap(n) 1
|
328
|
+
#define YY_SKIP_YYWRAP
|
329
|
+
|
330
|
+
typedef unsigned char YY_CHAR;
|
331
|
+
|
332
|
+
typedef int yy_state_type;
|
333
|
+
|
334
|
+
#define yytext_ptr yytext_r
|
335
|
+
|
336
|
+
static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
|
337
|
+
static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
|
338
|
+
static int yy_get_next_buffer (yyscan_t yyscanner );
|
339
|
+
static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
340
|
+
|
341
|
+
/* Done after the current pattern has been matched and before the
|
342
|
+
* corresponding action - sets up yytext.
|
343
|
+
*/
|
344
|
+
#define YY_DO_BEFORE_ACTION \
|
345
|
+
yyg->yytext_ptr = yy_bp; \
|
346
|
+
yyleng = (size_t) (yy_cp - yy_bp); \
|
347
|
+
yyg->yy_hold_char = *yy_cp; \
|
348
|
+
*yy_cp = '\0'; \
|
349
|
+
yyg->yy_c_buf_p = yy_cp;
|
350
|
+
|
351
|
+
#define YY_NUM_RULES 31
|
352
|
+
#define YY_END_OF_BUFFER 32
|
353
|
+
/* This struct is not used in this scanner,
|
354
|
+
but its presence is necessary. */
|
355
|
+
struct yy_trans_info
|
356
|
+
{
|
357
|
+
flex_int32_t yy_verify;
|
358
|
+
flex_int32_t yy_nxt;
|
359
|
+
};
|
360
|
+
static yyconst flex_int16_t yy_accept[179] =
|
361
|
+
{ 0,
|
362
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
363
|
+
8, 8, 32, 4, 4, 5, 30, 22, 23, 23,
|
364
|
+
24, 30, 13, 17, 17, 14, 17, 30, 17, 17,
|
365
|
+
17, 30, 17, 17, 17, 17, 17, 26, 26, 17,
|
366
|
+
17, 17, 17, 17, 29, 29, 29, 29, 29, 17,
|
367
|
+
31, 7, 7, 31, 8, 10, 10, 9, 4, 0,
|
368
|
+
2, 2, 0, 22, 23, 24, 24, 24, 0, 0,
|
369
|
+
24, 13, 14, 19, 0, 25, 0, 29, 19, 20,
|
370
|
+
16, 0, 0, 27, 27, 26, 0, 0, 0, 16,
|
371
|
+
0, 16, 0, 28, 29, 29, 29, 29, 29, 0,
|
372
|
+
|
373
|
+
7, 7, 6, 6, 0, 0, 8, 10, 9, 2,
|
374
|
+
2, 0, 0, 0, 0, 18, 29, 0, 27, 0,
|
375
|
+
26, 0, 15, 16, 29, 29, 0, 0, 0, 21,
|
376
|
+
0, 27, 0, 29, 29, 0, 0, 0, 27, 0,
|
377
|
+
11, 29, 3, 0, 0, 29, 0, 0, 29, 0,
|
378
|
+
0, 12, 0, 0, 0, 0, 0, 0, 0, 0,
|
379
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
380
|
+
0, 0, 0, 0, 0, 0, 1, 0
|
381
|
+
} ;
|
382
|
+
|
383
|
+
static yyconst flex_int32_t yy_ec[256] =
|
384
|
+
{ 0,
|
385
|
+
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
|
386
|
+
1, 4, 5, 1, 1, 1, 1, 1, 1, 1,
|
387
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
388
|
+
1, 2, 6, 7, 8, 9, 10, 11, 12, 13,
|
389
|
+
14, 15, 16, 14, 17, 18, 19, 20, 21, 21,
|
390
|
+
21, 21, 21, 21, 21, 21, 21, 22, 23, 24,
|
391
|
+
25, 26, 27, 14, 28, 29, 29, 30, 31, 29,
|
392
|
+
32, 32, 32, 32, 32, 32, 32, 33, 34, 32,
|
393
|
+
32, 35, 32, 32, 32, 32, 32, 36, 32, 32,
|
394
|
+
14, 37, 14, 38, 32, 1, 39, 29, 40, 29,
|
395
|
+
|
396
|
+
41, 42, 43, 44, 45, 32, 32, 46, 32, 47,
|
397
|
+
48, 49, 32, 50, 51, 52, 53, 32, 32, 54,
|
398
|
+
32, 32, 14, 55, 14, 14, 32, 32, 32, 32,
|
399
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
400
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
401
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
402
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
403
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
404
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
405
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
406
|
+
|
407
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
408
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
409
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
410
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
411
|
+
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
412
|
+
32, 32, 32, 32, 32
|
413
|
+
} ;
|
414
|
+
|
415
|
+
static yyconst flex_int32_t yy_meta[56] =
|
416
|
+
{ 0,
|
417
|
+
1, 2, 2, 1, 2, 1, 1, 1, 1, 1,
|
418
|
+
1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
|
419
|
+
3, 1, 1, 1, 1, 1, 1, 4, 4, 4,
|
420
|
+
4, 5, 5, 5, 5, 5, 1, 1, 4, 4,
|
421
|
+
4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
|
422
|
+
5, 5, 5, 5, 1
|
423
|
+
} ;
|
424
|
+
|
425
|
+
static yyconst flex_int16_t yy_base[195] =
|
426
|
+
{ 0,
|
427
|
+
0, 1, 25, 0, 80, 0, 135, 0, 190, 0,
|
428
|
+
245, 0, 645, 620, 619, 291, 732, 3, 732, 639,
|
429
|
+
299, 0, 0, 732, 1, 0, 616, 296, 0, 280,
|
430
|
+
296, 298, 615, 292, 294, 295, 309, 309, 318, 617,
|
431
|
+
322, 287, 297, 612, 349, 8, 353, 362, 366, 289,
|
432
|
+
3, 732, 634, 419, 634, 732, 632, 0, 610, 333,
|
433
|
+
607, 312, 587, 10, 732, 367, 732, 620, 592, 600,
|
434
|
+
371, 0, 0, 587, 346, 732, 605, 0, 732, 732,
|
435
|
+
732, 320, 601, 365, 368, 372, 1, 0, 552, 376,
|
436
|
+
575, 564, 402, 732, 473, 477, 482, 486, 491, 375,
|
437
|
+
|
438
|
+
732, 584, 732, 580, 0, 392, 577, 732, 0, 732,
|
439
|
+
732, 534, 527, 559, 395, 732, 0, 6, 477, 391,
|
440
|
+
0, 533, 732, 498, 507, 511, 522, 518, 540, 732,
|
441
|
+
396, 485, 503, 524, 528, 537, 499, 532, 501, 500,
|
442
|
+
541, 547, 732, 484, 486, 554, 559, 482, 563, 567,
|
443
|
+
579, 583, 493, 588, 481, 480, 466, 476, 459, 451,
|
444
|
+
592, 596, 604, 617, 434, 432, 433, 374, 358, 342,
|
445
|
+
324, 296, 623, 324, 313, 628, 732, 732, 666, 671,
|
446
|
+
676, 679, 682, 687, 689, 694, 698, 703, 706, 711,
|
447
|
+
714, 717, 721, 726
|
448
|
+
|
449
|
+
} ;
|
450
|
+
|
451
|
+
static yyconst flex_int16_t yy_def[195] =
|
452
|
+
{ 0,
|
453
|
+
179, 179, 178, 3, 178, 5, 178, 7, 178, 9,
|
454
|
+
178, 11, 178, 180, 180, 180, 178, 178, 178, 178,
|
455
|
+
181, 178, 182, 178, 178, 183, 178, 184, 185, 178,
|
456
|
+
178, 186, 178, 178, 178, 178, 178, 178, 178, 178,
|
457
|
+
178, 178, 178, 178, 187, 187, 187, 187, 187, 178,
|
458
|
+
188, 178, 178, 178, 178, 178, 178, 189, 180, 180,
|
459
|
+
178, 178, 178, 178, 178, 181, 178, 178, 181, 190,
|
460
|
+
181, 182, 183, 178, 184, 178, 184, 191, 178, 178,
|
461
|
+
178, 186, 186, 178, 178, 178, 178, 192, 178, 178,
|
462
|
+
178, 178, 178, 178, 187, 187, 187, 187, 187, 188,
|
463
|
+
|
464
|
+
178, 178, 178, 178, 54, 188, 178, 178, 189, 178,
|
465
|
+
178, 178, 178, 190, 193, 178, 191, 178, 178, 178,
|
466
|
+
192, 178, 178, 187, 187, 187, 178, 178, 194, 178,
|
467
|
+
178, 178, 178, 187, 187, 178, 178, 194, 178, 178,
|
468
|
+
187, 187, 178, 178, 178, 187, 178, 178, 187, 178,
|
469
|
+
178, 187, 178, 178, 178, 178, 178, 178, 178, 178,
|
470
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
471
|
+
178, 178, 178, 178, 178, 178, 178, 0, 178, 178,
|
472
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
473
|
+
178, 178, 178, 178
|
474
|
+
|
475
|
+
} ;
|
476
|
+
|
477
|
+
static yyconst flex_int16_t yy_nxt[788] =
|
478
|
+
{ 0,
|
479
|
+
178, 178, 15, 15, 64, 101, 64, 102, 178, 93,
|
480
|
+
93, 64, 93, 64, 70, 70, 120, 120, 71, 71,
|
481
|
+
94, 131, 131, 16, 16, 17, 18, 19, 18, 20,
|
482
|
+
17, 17, 21, 17, 17, 17, 17, 17, 17, 17,
|
483
|
+
17, 17, 17, 22, 17, 17, 17, 17, 17, 17,
|
484
|
+
17, 17, 23, 23, 23, 23, 23, 23, 23, 23,
|
485
|
+
23, 17, 17, 23, 23, 23, 23, 23, 23, 23,
|
486
|
+
23, 23, 23, 23, 23, 23, 23, 23, 23, 17,
|
487
|
+
17, 18, 19, 18, 20, 24, 17, 21, 24, 24,
|
488
|
+
24, 17, 24, 24, 24, 24, 24, 24, 25, 17,
|
489
|
+
|
490
|
+
17, 24, 24, 24, 24, 24, 24, 26, 26, 26,
|
491
|
+
26, 26, 26, 26, 26, 26, 17, 24, 26, 26,
|
492
|
+
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
493
|
+
26, 26, 26, 26, 24, 17, 18, 19, 18, 20,
|
494
|
+
27, 28, 21, 29, 30, 31, 32, 24, 24, 33,
|
495
|
+
34, 35, 36, 37, 38, 39, 40, 24, 41, 42,
|
496
|
+
43, 44, 45, 46, 46, 46, 46, 46, 46, 46,
|
497
|
+
47, 17, 33, 46, 48, 46, 49, 46, 46, 46,
|
498
|
+
46, 46, 46, 46, 46, 46, 46, 46, 46, 50,
|
499
|
+
51, 51, 52, 51, 53, 51, 51, 51, 51, 51,
|
500
|
+
|
501
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
502
|
+
51, 51, 51, 51, 51, 51, 51, 54, 54, 54,
|
503
|
+
54, 54, 54, 54, 54, 54, 51, 51, 54, 54,
|
504
|
+
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
505
|
+
54, 54, 54, 54, 51, 17, 55, 56, 17, 57,
|
506
|
+
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
|
507
|
+
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
|
508
|
+
17, 17, 58, 58, 58, 58, 58, 58, 58, 58,
|
509
|
+
58, 17, 17, 58, 58, 58, 58, 58, 58, 58,
|
510
|
+
58, 58, 58, 58, 58, 58, 58, 58, 58, 17,
|
511
|
+
|
512
|
+
61, 67, 76, 68, 79, 80, 81, 81, 69, 76,
|
513
|
+
81, 91, 81, 79, 84, 84, 79, 62, 79, 79,
|
514
|
+
79, 79, 92, 70, 173, 69, 85, 71, 86, 86,
|
515
|
+
173, 76, 77, 79, 83, 85, 111, 86, 86, 87,
|
516
|
+
89, 63, 178, 81, 175, 90, 79, 81, 87, 87,
|
517
|
+
93, 93, 76, 93, 93, 93, 83, 93, 87, 178,
|
518
|
+
112, 94, 88, 93, 93, 94, 93, 93, 93, 67,
|
519
|
+
93, 68, 174, 67, 94, 68, 69, 101, 94, 102,
|
520
|
+
69, 96, 77, 178, 84, 84, 97, 119, 119, 85,
|
521
|
+
173, 86, 86, 69, 103, 118, 104, 69, 118, 123,
|
522
|
+
|
523
|
+
116, 172, 87, 93, 93, 118, 93, 98, 118, 115,
|
524
|
+
132, 132, 87, 130, 94, 139, 139, 171, 99, 100,
|
525
|
+
100, 103, 100, 104, 100, 100, 100, 100, 100, 100,
|
526
|
+
100, 100, 100, 100, 100, 100, 100, 100, 105, 105,
|
527
|
+
100, 106, 100, 100, 100, 100, 105, 105, 105, 105,
|
528
|
+
105, 105, 105, 105, 105, 100, 100, 105, 105, 105,
|
529
|
+
105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
|
530
|
+
105, 105, 105, 100, 93, 93, 170, 93, 93, 93,
|
531
|
+
169, 93, 168, 93, 93, 94, 93, 93, 93, 94,
|
532
|
+
93, 161, 93, 93, 94, 93, 119, 119, 94, 93,
|
533
|
+
|
534
|
+
93, 160, 93, 94, 132, 132, 124, 118, 93, 93,
|
535
|
+
94, 93, 93, 93, 159, 93, 124, 118, 158, 94,
|
536
|
+
139, 139, 157, 94, 125, 93, 93, 156, 93, 93,
|
537
|
+
93, 155, 93, 151, 148, 147, 94, 126, 143, 143,
|
538
|
+
94, 143, 93, 93, 145, 93, 115, 144, 93, 93,
|
539
|
+
135, 93, 140, 94, 115, 93, 93, 134, 93, 94,
|
540
|
+
150, 150, 137, 150, 93, 93, 94, 93, 150, 150,
|
541
|
+
136, 150, 133, 115, 141, 94, 128, 127, 107, 142,
|
542
|
+
154, 154, 103, 154, 93, 93, 101, 93, 116, 154,
|
543
|
+
154, 146, 154, 162, 162, 94, 162, 162, 162, 116,
|
544
|
+
|
545
|
+
162, 149, 122, 178, 80, 164, 164, 178, 164, 152,
|
546
|
+
165, 116, 153, 80, 115, 166, 163, 178, 164, 164,
|
547
|
+
163, 164, 67, 165, 176, 176, 113, 176, 166, 176,
|
548
|
+
176, 110, 176, 60, 108, 107, 101, 80, 81, 79,
|
549
|
+
74, 65, 60, 60, 178, 178, 178, 178, 177, 178,
|
550
|
+
178, 178, 167, 177, 178, 178, 178, 178, 178, 178,
|
551
|
+
178, 178, 178, 178, 178, 167, 14, 14, 14, 14,
|
552
|
+
14, 59, 59, 59, 59, 59, 66, 66, 66, 66,
|
553
|
+
66, 72, 72, 72, 73, 73, 73, 75, 75, 75,
|
554
|
+
75, 75, 78, 78, 82, 82, 82, 82, 82, 95,
|
555
|
+
|
556
|
+
95, 95, 95, 100, 100, 100, 100, 100, 109, 109,
|
557
|
+
109, 114, 114, 114, 114, 114, 117, 117, 117, 121,
|
558
|
+
121, 129, 129, 129, 129, 129, 138, 138, 138, 138,
|
559
|
+
138, 13, 178, 178, 178, 178, 178, 178, 178, 178,
|
560
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
561
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
562
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
563
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
564
|
+
178, 178, 178, 178, 178, 178, 178
|
565
|
+
} ;
|
566
|
+
|
567
|
+
static yyconst flex_int16_t yy_chk[788] =
|
568
|
+
{ 0,
|
569
|
+
0, 0, 1, 2, 18, 51, 18, 51, 0, 46,
|
570
|
+
46, 64, 46, 64, 22, 25, 87, 87, 22, 25,
|
571
|
+
46, 118, 118, 1, 2, 3, 3, 3, 3, 3,
|
572
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
573
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
574
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
575
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
576
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
577
|
+
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
578
|
+
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
579
|
+
|
580
|
+
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
581
|
+
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
582
|
+
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
583
|
+
5, 5, 5, 5, 5, 7, 7, 7, 7, 7,
|
584
|
+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
585
|
+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
586
|
+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
587
|
+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
588
|
+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
589
|
+
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
590
|
+
|
591
|
+
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
592
|
+
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
593
|
+
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
594
|
+
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
595
|
+
9, 9, 9, 9, 9, 11, 11, 11, 11, 11,
|
596
|
+
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
597
|
+
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
598
|
+
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
599
|
+
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
600
|
+
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
601
|
+
|
602
|
+
16, 21, 28, 21, 30, 30, 31, 34, 21, 32,
|
603
|
+
35, 42, 42, 50, 36, 36, 34, 16, 35, 36,
|
604
|
+
31, 43, 43, 37, 175, 21, 38, 37, 38, 38,
|
605
|
+
174, 82, 28, 37, 32, 39, 62, 39, 39, 38,
|
606
|
+
41, 16, 60, 50, 172, 41, 41, 41, 39, 38,
|
607
|
+
45, 45, 75, 45, 47, 47, 82, 47, 39, 60,
|
608
|
+
62, 45, 38, 48, 48, 47, 48, 49, 49, 66,
|
609
|
+
49, 66, 171, 71, 48, 71, 66, 100, 49, 100,
|
610
|
+
71, 45, 75, 60, 84, 84, 47, 85, 85, 86,
|
611
|
+
170, 86, 86, 66, 106, 84, 106, 71, 85, 90,
|
612
|
+
|
613
|
+
90, 169, 86, 93, 93, 84, 93, 48, 85, 115,
|
614
|
+
120, 120, 86, 115, 93, 131, 131, 168, 49, 54,
|
615
|
+
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
616
|
+
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
617
|
+
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
618
|
+
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
619
|
+
54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
620
|
+
54, 54, 54, 54, 95, 95, 167, 95, 96, 96,
|
621
|
+
166, 96, 165, 97, 97, 95, 97, 98, 98, 96,
|
622
|
+
98, 160, 99, 99, 97, 99, 119, 119, 98, 124,
|
623
|
+
|
624
|
+
124, 159, 124, 99, 132, 132, 96, 119, 125, 125,
|
625
|
+
124, 125, 126, 126, 158, 126, 97, 119, 157, 125,
|
626
|
+
139, 139, 156, 126, 98, 134, 134, 155, 134, 135,
|
627
|
+
135, 153, 135, 148, 145, 144, 134, 99, 136, 136,
|
628
|
+
135, 136, 141, 141, 140, 141, 138, 137, 142, 142,
|
629
|
+
126, 142, 133, 141, 129, 146, 146, 125, 146, 142,
|
630
|
+
147, 147, 128, 147, 149, 149, 146, 149, 150, 150,
|
631
|
+
127, 150, 122, 114, 134, 149, 113, 112, 107, 135,
|
632
|
+
151, 151, 104, 151, 152, 152, 102, 152, 92, 154,
|
633
|
+
154, 142, 154, 161, 161, 152, 161, 162, 162, 91,
|
634
|
+
|
635
|
+
162, 146, 89, 83, 151, 163, 163, 77, 163, 149,
|
636
|
+
163, 74, 150, 154, 70, 163, 161, 69, 164, 164,
|
637
|
+
162, 164, 68, 164, 173, 173, 63, 173, 164, 176,
|
638
|
+
176, 61, 176, 59, 57, 55, 53, 44, 40, 33,
|
639
|
+
27, 20, 15, 14, 13, 0, 0, 0, 173, 0,
|
640
|
+
0, 0, 163, 176, 0, 0, 0, 0, 0, 0,
|
641
|
+
0, 0, 0, 0, 0, 164, 179, 179, 179, 179,
|
642
|
+
179, 180, 180, 180, 180, 180, 181, 181, 181, 181,
|
643
|
+
181, 182, 182, 182, 183, 183, 183, 184, 184, 184,
|
644
|
+
184, 184, 185, 185, 186, 186, 186, 186, 186, 187,
|
645
|
+
|
646
|
+
187, 187, 187, 188, 188, 188, 188, 188, 189, 189,
|
647
|
+
189, 190, 190, 190, 190, 190, 191, 191, 191, 192,
|
648
|
+
192, 193, 193, 193, 193, 193, 194, 194, 194, 194,
|
649
|
+
194, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
650
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
651
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
652
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
653
|
+
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
|
654
|
+
178, 178, 178, 178, 178, 178, 178
|
655
|
+
} ;
|
656
|
+
|
657
|
+
/* The intent behind this definition is that it'll catch
|
658
|
+
* any uses of REJECT which flex missed.
|
659
|
+
*/
|
660
|
+
#define REJECT reject_used_but_not_detected
|
661
|
+
#define yymore() yymore_used_but_not_detected
|
662
|
+
#define YY_MORE_ADJ 0
|
663
|
+
#define YY_RESTORE_YY_MORE_OFFSET
|
664
|
+
/*
|
665
|
+
* phptok.l - a lex rule for PHP
|
666
|
+
*
|
667
|
+
* Copyright (C) 2005 MATSUNO Tokuhiro <tokuhirom at yahoo.co.jp>
|
668
|
+
* All rights reserved.
|
669
|
+
* This is free software with ABSOLUTELY NO WARRANTY.
|
670
|
+
*
|
671
|
+
* You can redistribute it and/or modify it under the terms of
|
672
|
+
* the GNU General Public License version 2.
|
673
|
+
*/
|
674
|
+
|
675
|
+
#include "php.h"
|
676
|
+
|
677
|
+
#define YY_EXTRA_TYPE langscan_php_lex_extra_t *
|
678
|
+
|
679
|
+
#if YY_NULL != 0
|
680
|
+
#error "YY_NULL is not 0."
|
681
|
+
#endif
|
682
|
+
|
683
|
+
#define YY_DECL langscan_php_token_t langscan_php_lex_lex(yyscan_t yyscanner)
|
684
|
+
|
685
|
+
#define YY_INPUT(buf,result,max_size) \
|
686
|
+
if (!yyextra->eof) { \
|
687
|
+
result = yyextra->user_read(&(yyextra->user_data), (buf), (max_size)); \
|
688
|
+
if (result == 0) \
|
689
|
+
yyextra->eof = 1; \
|
690
|
+
}
|
691
|
+
|
692
|
+
#define UPD update_pos(yyextra, yytext, yyleng)
|
693
|
+
static void update_pos(langscan_php_lex_extra_t *, char *, int);
|
694
|
+
|
695
|
+
#define report(token) \
|
696
|
+
do { \
|
697
|
+
yyextra->text = yytext; \
|
698
|
+
yyextra->leng = yyleng; \
|
699
|
+
return langscan_php_##token; \
|
700
|
+
} while (0)
|
701
|
+
|
702
|
+
char *heredocident=NULL;
|
703
|
+
int heredocidentlen=0;
|
704
|
+
|
705
|
+
#define INITIAL 0
|
706
|
+
#define CLASSDEF 1
|
707
|
+
#define FUNDEF 2
|
708
|
+
#define SCRIPT 3
|
709
|
+
#define HEREDOC 4
|
710
|
+
#define HEREDOCBEG 5
|
711
|
+
|
712
|
+
#ifndef YY_NO_UNISTD_H
|
713
|
+
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
714
|
+
* down here because we want the user's section 1 to have been scanned first.
|
715
|
+
* The user has a chance to override it with an option.
|
716
|
+
*/
|
717
|
+
#include <unistd.h>
|
718
|
+
#endif
|
719
|
+
|
720
|
+
#ifndef YY_EXTRA_TYPE
|
721
|
+
#define YY_EXTRA_TYPE void *
|
722
|
+
#endif
|
723
|
+
|
724
|
+
/* Holds the entire state of the reentrant scanner. */
|
725
|
+
struct yyguts_t
|
726
|
+
{
|
727
|
+
|
728
|
+
/* User-defined. Not touched by flex. */
|
729
|
+
YY_EXTRA_TYPE yyextra_r;
|
730
|
+
|
731
|
+
/* The rest are the same as the globals declared in the non-reentrant scanner. */
|
732
|
+
FILE *yyin_r, *yyout_r;
|
733
|
+
size_t yy_buffer_stack_top; /**< index of top of stack. */
|
734
|
+
size_t yy_buffer_stack_max; /**< capacity of stack. */
|
735
|
+
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
|
736
|
+
char yy_hold_char;
|
737
|
+
yy_size_t yy_n_chars;
|
738
|
+
yy_size_t yyleng_r;
|
739
|
+
char *yy_c_buf_p;
|
740
|
+
int yy_init;
|
741
|
+
int yy_start;
|
742
|
+
int yy_did_buffer_switch_on_eof;
|
743
|
+
int yy_start_stack_ptr;
|
744
|
+
int yy_start_stack_depth;
|
745
|
+
int *yy_start_stack;
|
746
|
+
yy_state_type yy_last_accepting_state;
|
747
|
+
char* yy_last_accepting_cpos;
|
748
|
+
|
749
|
+
int yylineno_r;
|
750
|
+
int yy_flex_debug_r;
|
751
|
+
|
752
|
+
char *yytext_r;
|
753
|
+
int yy_more_flag;
|
754
|
+
int yy_more_len;
|
755
|
+
|
756
|
+
}; /* end struct yyguts_t */
|
757
|
+
|
758
|
+
static int yy_init_globals (yyscan_t yyscanner );
|
759
|
+
|
760
|
+
int langscan_php_lex_lex_init (yyscan_t* scanner);
|
761
|
+
|
762
|
+
int langscan_php_lex_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
|
763
|
+
|
764
|
+
/* Accessor methods to globals.
|
765
|
+
These are made visible to non-reentrant scanners for convenience. */
|
766
|
+
|
767
|
+
int langscan_php_lex_lex_destroy (yyscan_t yyscanner );
|
768
|
+
|
769
|
+
int langscan_php_lex_get_debug (yyscan_t yyscanner );
|
770
|
+
|
771
|
+
void langscan_php_lex_set_debug (int debug_flag ,yyscan_t yyscanner );
|
772
|
+
|
773
|
+
YY_EXTRA_TYPE langscan_php_lex_get_extra (yyscan_t yyscanner );
|
774
|
+
|
775
|
+
void langscan_php_lex_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
|
776
|
+
|
777
|
+
FILE *langscan_php_lex_get_in (yyscan_t yyscanner );
|
778
|
+
|
779
|
+
void langscan_php_lex_set_in (FILE * in_str ,yyscan_t yyscanner );
|
780
|
+
|
781
|
+
FILE *langscan_php_lex_get_out (yyscan_t yyscanner );
|
782
|
+
|
783
|
+
void langscan_php_lex_set_out (FILE * out_str ,yyscan_t yyscanner );
|
784
|
+
|
785
|
+
yy_size_t langscan_php_lex_get_leng (yyscan_t yyscanner );
|
786
|
+
|
787
|
+
char *langscan_php_lex_get_text (yyscan_t yyscanner );
|
788
|
+
|
789
|
+
int langscan_php_lex_get_lineno (yyscan_t yyscanner );
|
790
|
+
|
791
|
+
void langscan_php_lex_set_lineno (int line_number ,yyscan_t yyscanner );
|
792
|
+
|
793
|
+
/* Macros after this point can all be overridden by user definitions in
|
794
|
+
* section 1.
|
795
|
+
*/
|
796
|
+
|
797
|
+
#ifndef YY_SKIP_YYWRAP
|
798
|
+
#ifdef __cplusplus
|
799
|
+
extern "C" int langscan_php_lex_wrap (yyscan_t yyscanner );
|
800
|
+
#else
|
801
|
+
extern int langscan_php_lex_wrap (yyscan_t yyscanner );
|
802
|
+
#endif
|
803
|
+
#endif
|
804
|
+
|
805
|
+
static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
|
806
|
+
|
807
|
+
#ifndef yytext_ptr
|
808
|
+
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
|
809
|
+
#endif
|
810
|
+
|
811
|
+
#ifdef YY_NEED_STRLEN
|
812
|
+
static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
|
813
|
+
#endif
|
814
|
+
|
815
|
+
#ifndef YY_NO_INPUT
|
816
|
+
|
817
|
+
#ifdef __cplusplus
|
818
|
+
static int yyinput (yyscan_t yyscanner );
|
819
|
+
#else
|
820
|
+
static int input (yyscan_t yyscanner );
|
821
|
+
#endif
|
822
|
+
|
823
|
+
#endif
|
824
|
+
|
825
|
+
/* Amount of stuff to slurp up with each read. */
|
826
|
+
#ifndef YY_READ_BUF_SIZE
|
827
|
+
#define YY_READ_BUF_SIZE 8192
|
828
|
+
#endif
|
829
|
+
|
830
|
+
/* Copy whatever the last rule matched to the standard output. */
|
831
|
+
#ifndef ECHO
|
832
|
+
/* This used to be an fputs(), but since the string might contain NUL's,
|
833
|
+
* we now use fwrite().
|
834
|
+
*/
|
835
|
+
#define ECHO fwrite( yytext, yyleng, 1, yyout )
|
836
|
+
#endif
|
837
|
+
|
838
|
+
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
839
|
+
* is returned in "result".
|
840
|
+
*/
|
841
|
+
#ifndef YY_INPUT
|
842
|
+
#define YY_INPUT(buf,result,max_size) \
|
843
|
+
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
844
|
+
{ \
|
845
|
+
int c = '*'; \
|
846
|
+
yy_size_t n; \
|
847
|
+
for ( n = 0; n < max_size && \
|
848
|
+
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
849
|
+
buf[n] = (char) c; \
|
850
|
+
if ( c == '\n' ) \
|
851
|
+
buf[n++] = (char) c; \
|
852
|
+
if ( c == EOF && ferror( yyin ) ) \
|
853
|
+
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
854
|
+
result = n; \
|
855
|
+
} \
|
856
|
+
else \
|
857
|
+
{ \
|
858
|
+
errno=0; \
|
859
|
+
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
|
860
|
+
{ \
|
861
|
+
if( errno != EINTR) \
|
862
|
+
{ \
|
863
|
+
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
864
|
+
break; \
|
865
|
+
} \
|
866
|
+
errno=0; \
|
867
|
+
clearerr(yyin); \
|
868
|
+
} \
|
869
|
+
}\
|
870
|
+
\
|
871
|
+
|
872
|
+
#endif
|
873
|
+
|
874
|
+
/* No semi-colon after return; correct usage is to write "yyterminate();" -
|
875
|
+
* we don't want an extra ';' after the "return" because that will cause
|
876
|
+
* some compilers to complain about unreachable statements.
|
877
|
+
*/
|
878
|
+
#ifndef yyterminate
|
879
|
+
#define yyterminate() return YY_NULL
|
880
|
+
#endif
|
881
|
+
|
882
|
+
/* Number of entries by which start-condition stack grows. */
|
883
|
+
#ifndef YY_START_STACK_INCR
|
884
|
+
#define YY_START_STACK_INCR 25
|
885
|
+
#endif
|
886
|
+
|
887
|
+
/* Report a fatal error. */
|
888
|
+
#ifndef YY_FATAL_ERROR
|
889
|
+
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
|
890
|
+
#endif
|
891
|
+
|
892
|
+
/* end tables serialization structures and prototypes */
|
893
|
+
|
894
|
+
/* Default declaration of generated scanner - a define so the user can
|
895
|
+
* easily add parameters.
|
896
|
+
*/
|
897
|
+
#ifndef YY_DECL
|
898
|
+
#define YY_DECL_IS_OURS 1
|
899
|
+
|
900
|
+
extern int langscan_php_lex_lex (yyscan_t yyscanner);
|
901
|
+
|
902
|
+
#define YY_DECL int langscan_php_lex_lex (yyscan_t yyscanner)
|
903
|
+
#endif /* !YY_DECL */
|
904
|
+
|
905
|
+
/* Code executed at the beginning of each rule, after yytext and yyleng
|
906
|
+
* have been set up.
|
907
|
+
*/
|
908
|
+
#ifndef YY_USER_ACTION
|
909
|
+
#define YY_USER_ACTION
|
910
|
+
#endif
|
911
|
+
|
912
|
+
/* Code executed at the end of each rule. */
|
913
|
+
#ifndef YY_BREAK
|
914
|
+
#define YY_BREAK break;
|
915
|
+
#endif
|
916
|
+
|
917
|
+
#define YY_RULE_SETUP \
|
918
|
+
YY_USER_ACTION
|
919
|
+
|
920
|
+
/** The main scanner function which does all the work.
|
921
|
+
*/
|
922
|
+
YY_DECL
|
923
|
+
{
|
924
|
+
register yy_state_type yy_current_state;
|
925
|
+
register char *yy_cp, *yy_bp;
|
926
|
+
register int yy_act;
|
927
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
928
|
+
|
929
|
+
if ( !yyg->yy_init )
|
930
|
+
{
|
931
|
+
yyg->yy_init = 1;
|
932
|
+
|
933
|
+
#ifdef YY_USER_INIT
|
934
|
+
YY_USER_INIT;
|
935
|
+
#endif
|
936
|
+
|
937
|
+
if ( ! yyg->yy_start )
|
938
|
+
yyg->yy_start = 1; /* first start state */
|
939
|
+
|
940
|
+
if ( ! yyin )
|
941
|
+
yyin = stdin;
|
942
|
+
|
943
|
+
if ( ! yyout )
|
944
|
+
yyout = stdout;
|
945
|
+
|
946
|
+
if ( ! YY_CURRENT_BUFFER ) {
|
947
|
+
langscan_php_lex_ensure_buffer_stack (yyscanner);
|
948
|
+
YY_CURRENT_BUFFER_LVALUE =
|
949
|
+
langscan_php_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
|
950
|
+
}
|
951
|
+
|
952
|
+
langscan_php_lex__load_buffer_state(yyscanner );
|
953
|
+
}
|
954
|
+
|
955
|
+
while ( 1 ) /* loops until end-of-file is reached */
|
956
|
+
{
|
957
|
+
yy_cp = yyg->yy_c_buf_p;
|
958
|
+
|
959
|
+
/* Support of yytext. */
|
960
|
+
*yy_cp = yyg->yy_hold_char;
|
961
|
+
|
962
|
+
/* yy_bp points to the position in yy_ch_buf of the start of
|
963
|
+
* the current run.
|
964
|
+
*/
|
965
|
+
yy_bp = yy_cp;
|
966
|
+
|
967
|
+
yy_current_state = yyg->yy_start;
|
968
|
+
yy_match:
|
969
|
+
do
|
970
|
+
{
|
971
|
+
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
|
972
|
+
if ( yy_accept[yy_current_state] )
|
973
|
+
{
|
974
|
+
yyg->yy_last_accepting_state = yy_current_state;
|
975
|
+
yyg->yy_last_accepting_cpos = yy_cp;
|
976
|
+
}
|
977
|
+
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
978
|
+
{
|
979
|
+
yy_current_state = (int) yy_def[yy_current_state];
|
980
|
+
if ( yy_current_state >= 179 )
|
981
|
+
yy_c = yy_meta[(unsigned int) yy_c];
|
982
|
+
}
|
983
|
+
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
984
|
+
++yy_cp;
|
985
|
+
}
|
986
|
+
while ( yy_base[yy_current_state] != 732 );
|
987
|
+
|
988
|
+
yy_find_action:
|
989
|
+
yy_act = yy_accept[yy_current_state];
|
990
|
+
if ( yy_act == 0 )
|
991
|
+
{ /* have to back up */
|
992
|
+
yy_cp = yyg->yy_last_accepting_cpos;
|
993
|
+
yy_current_state = yyg->yy_last_accepting_state;
|
994
|
+
yy_act = yy_accept[yy_current_state];
|
995
|
+
}
|
996
|
+
|
997
|
+
YY_DO_BEFORE_ACTION;
|
998
|
+
|
999
|
+
do_action: /* This label is used only to access EOF actions. */
|
1000
|
+
|
1001
|
+
switch ( yy_act )
|
1002
|
+
{ /* beginning of action switch */
|
1003
|
+
case 0: /* must back up */
|
1004
|
+
/* undo the effects of YY_DO_BEFORE_ACTION */
|
1005
|
+
*yy_cp = yyg->yy_hold_char;
|
1006
|
+
yy_cp = yyg->yy_last_accepting_cpos;
|
1007
|
+
yy_current_state = yyg->yy_last_accepting_state;
|
1008
|
+
goto yy_find_action;
|
1009
|
+
|
1010
|
+
case 1:
|
1011
|
+
/* rule 1 can match eol */
|
1012
|
+
YY_RULE_SETUP
|
1013
|
+
{ UPD; BEGIN(SCRIPT); report(ident);}
|
1014
|
+
YY_BREAK
|
1015
|
+
case 2:
|
1016
|
+
YY_RULE_SETUP
|
1017
|
+
{ UPD; BEGIN(SCRIPT); report(ident);}
|
1018
|
+
YY_BREAK
|
1019
|
+
case 3:
|
1020
|
+
/* rule 3 can match eol */
|
1021
|
+
YY_RULE_SETUP
|
1022
|
+
{ UPD; BEGIN(SCRIPT); report(ident);}
|
1023
|
+
YY_BREAK
|
1024
|
+
case 4:
|
1025
|
+
/* rule 4 can match eol */
|
1026
|
+
YY_RULE_SETUP
|
1027
|
+
{ UPD; report(comment);}
|
1028
|
+
YY_BREAK
|
1029
|
+
case 5:
|
1030
|
+
YY_RULE_SETUP
|
1031
|
+
{ UPD; report(comment);}
|
1032
|
+
YY_BREAK
|
1033
|
+
case 6:
|
1034
|
+
/* rule 6 can match eol */
|
1035
|
+
YY_RULE_SETUP
|
1036
|
+
{
|
1037
|
+
int identlen = strpbrk(yytext, ";\r\n")-yytext;
|
1038
|
+
if (heredocidentlen==identlen && !strncmp(heredocident, yytext, identlen)) {
|
1039
|
+
free(heredocident);
|
1040
|
+
heredocident = NULL;
|
1041
|
+
BEGIN(SCRIPT);
|
1042
|
+
yyless(0);
|
1043
|
+
} else {
|
1044
|
+
UPD;
|
1045
|
+
report(string);
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
YY_BREAK
|
1049
|
+
case 7:
|
1050
|
+
/* rule 7 can match eol */
|
1051
|
+
YY_RULE_SETUP
|
1052
|
+
{ UPD; report(string);}
|
1053
|
+
YY_BREAK
|
1054
|
+
case 8:
|
1055
|
+
YY_RULE_SETUP
|
1056
|
+
{ UPD; report(space); }
|
1057
|
+
YY_BREAK
|
1058
|
+
case 9:
|
1059
|
+
YY_RULE_SETUP
|
1060
|
+
{ UPD; heredocident=strdup(yytext); heredocidentlen=yyleng; report(ident); }
|
1061
|
+
YY_BREAK
|
1062
|
+
case 10:
|
1063
|
+
/* rule 10 can match eol */
|
1064
|
+
YY_RULE_SETUP
|
1065
|
+
{ UPD;
|
1066
|
+
if(heredocident) {
|
1067
|
+
BEGIN(HEREDOC);
|
1068
|
+
report(space);
|
1069
|
+
} else { /* invalid here-document */
|
1070
|
+
BEGIN(SCRIPT);
|
1071
|
+
report(space);
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
YY_BREAK
|
1075
|
+
case 11:
|
1076
|
+
YY_RULE_SETUP
|
1077
|
+
{ UPD; BEGIN(CLASSDEF); report(keyword); }
|
1078
|
+
YY_BREAK
|
1079
|
+
case 12:
|
1080
|
+
YY_RULE_SETUP
|
1081
|
+
{ UPD; BEGIN(FUNDEF); report(keyword); }
|
1082
|
+
YY_BREAK
|
1083
|
+
case 13:
|
1084
|
+
YY_RULE_SETUP
|
1085
|
+
{ UPD; BEGIN(SCRIPT); report(classdef); }
|
1086
|
+
YY_BREAK
|
1087
|
+
case 14:
|
1088
|
+
YY_RULE_SETUP
|
1089
|
+
{ UPD; BEGIN(SCRIPT); report(fundef); }
|
1090
|
+
YY_BREAK
|
1091
|
+
case 15:
|
1092
|
+
YY_RULE_SETUP
|
1093
|
+
{ UPD; BEGIN(HEREDOCBEG); report(punct); }
|
1094
|
+
YY_BREAK
|
1095
|
+
case 16:
|
1096
|
+
YY_RULE_SETUP
|
1097
|
+
{ UPD; report(punct); }
|
1098
|
+
YY_BREAK
|
1099
|
+
case 17:
|
1100
|
+
YY_RULE_SETUP
|
1101
|
+
{ UPD; report(punct); }
|
1102
|
+
YY_BREAK
|
1103
|
+
case 18:
|
1104
|
+
YY_RULE_SETUP
|
1105
|
+
{ UPD; report(punct); }
|
1106
|
+
YY_BREAK
|
1107
|
+
case 19:
|
1108
|
+
YY_RULE_SETUP
|
1109
|
+
{ UPD; report(punct); }
|
1110
|
+
YY_BREAK
|
1111
|
+
case 20:
|
1112
|
+
/* rule 20 can match eol */
|
1113
|
+
YY_RULE_SETUP
|
1114
|
+
{ UPD; BEGIN(INITIAL); report(ident);}
|
1115
|
+
YY_BREAK
|
1116
|
+
case 21:
|
1117
|
+
/* rule 21 can match eol */
|
1118
|
+
YY_RULE_SETUP
|
1119
|
+
{ UPD; report(comment);}
|
1120
|
+
YY_BREAK
|
1121
|
+
case 22:
|
1122
|
+
YY_RULE_SETUP
|
1123
|
+
{ UPD; report(space); }
|
1124
|
+
YY_BREAK
|
1125
|
+
case 23:
|
1126
|
+
/* rule 23 can match eol */
|
1127
|
+
YY_RULE_SETUP
|
1128
|
+
{ UPD; report(space); }
|
1129
|
+
YY_BREAK
|
1130
|
+
case 24:
|
1131
|
+
/* rule 24 can match eol */
|
1132
|
+
YY_RULE_SETUP
|
1133
|
+
{ UPD; report(comment); }
|
1134
|
+
YY_BREAK
|
1135
|
+
case 25:
|
1136
|
+
/* rule 25 can match eol */
|
1137
|
+
YY_RULE_SETUP
|
1138
|
+
{ UPD; report(string); }
|
1139
|
+
YY_BREAK
|
1140
|
+
case 26:
|
1141
|
+
YY_RULE_SETUP
|
1142
|
+
{ UPD; report(integer); }
|
1143
|
+
YY_BREAK
|
1144
|
+
case 27:
|
1145
|
+
YY_RULE_SETUP
|
1146
|
+
{ UPD; report(floating); }
|
1147
|
+
YY_BREAK
|
1148
|
+
case 28:
|
1149
|
+
/* rule 28 can match eol */
|
1150
|
+
YY_RULE_SETUP
|
1151
|
+
{ yyless(strpbrk(yytext, " \t\b\f\r\n(")-yytext); UPD; report(funcall); }
|
1152
|
+
YY_BREAK
|
1153
|
+
case 29:
|
1154
|
+
YY_RULE_SETUP
|
1155
|
+
{ UPD; report(ident); }
|
1156
|
+
YY_BREAK
|
1157
|
+
case 30:
|
1158
|
+
YY_RULE_SETUP
|
1159
|
+
{ UPD; fprintf(stderr, "Token Error : %s\n", yytext); report(punct); }
|
1160
|
+
YY_BREAK
|
1161
|
+
case 31:
|
1162
|
+
YY_RULE_SETUP
|
1163
|
+
YY_FATAL_ERROR( "flex scanner jammed" );
|
1164
|
+
YY_BREAK
|
1165
|
+
case YY_STATE_EOF(INITIAL):
|
1166
|
+
case YY_STATE_EOF(CLASSDEF):
|
1167
|
+
case YY_STATE_EOF(FUNDEF):
|
1168
|
+
case YY_STATE_EOF(SCRIPT):
|
1169
|
+
case YY_STATE_EOF(HEREDOC):
|
1170
|
+
case YY_STATE_EOF(HEREDOCBEG):
|
1171
|
+
yyterminate();
|
1172
|
+
|
1173
|
+
case YY_END_OF_BUFFER:
|
1174
|
+
{
|
1175
|
+
/* Amount of text matched not including the EOB char. */
|
1176
|
+
int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
|
1177
|
+
|
1178
|
+
/* Undo the effects of YY_DO_BEFORE_ACTION. */
|
1179
|
+
*yy_cp = yyg->yy_hold_char;
|
1180
|
+
YY_RESTORE_YY_MORE_OFFSET
|
1181
|
+
|
1182
|
+
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
|
1183
|
+
{
|
1184
|
+
/* We're scanning a new file or input source. It's
|
1185
|
+
* possible that this happened because the user
|
1186
|
+
* just pointed yyin at a new source and called
|
1187
|
+
* langscan_php_lex_lex(). If so, then we have to assure
|
1188
|
+
* consistency between YY_CURRENT_BUFFER and our
|
1189
|
+
* globals. Here is the right place to do so, because
|
1190
|
+
* this is the first action (other than possibly a
|
1191
|
+
* back-up) that will match for the new input source.
|
1192
|
+
*/
|
1193
|
+
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
|
1194
|
+
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
|
1195
|
+
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
/* Note that here we test for yy_c_buf_p "<=" to the position
|
1199
|
+
* of the first EOB in the buffer, since yy_c_buf_p will
|
1200
|
+
* already have been incremented past the NUL character
|
1201
|
+
* (since all states make transitions on EOB to the
|
1202
|
+
* end-of-buffer state). Contrast this with the test
|
1203
|
+
* in input().
|
1204
|
+
*/
|
1205
|
+
if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
|
1206
|
+
{ /* This was really a NUL. */
|
1207
|
+
yy_state_type yy_next_state;
|
1208
|
+
|
1209
|
+
yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
|
1210
|
+
|
1211
|
+
yy_current_state = yy_get_previous_state( yyscanner );
|
1212
|
+
|
1213
|
+
/* Okay, we're now positioned to make the NUL
|
1214
|
+
* transition. We couldn't have
|
1215
|
+
* yy_get_previous_state() go ahead and do it
|
1216
|
+
* for us because it doesn't know how to deal
|
1217
|
+
* with the possibility of jamming (and we don't
|
1218
|
+
* want to build jamming into it because then it
|
1219
|
+
* will run more slowly).
|
1220
|
+
*/
|
1221
|
+
|
1222
|
+
yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
|
1223
|
+
|
1224
|
+
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
|
1225
|
+
|
1226
|
+
if ( yy_next_state )
|
1227
|
+
{
|
1228
|
+
/* Consume the NUL. */
|
1229
|
+
yy_cp = ++yyg->yy_c_buf_p;
|
1230
|
+
yy_current_state = yy_next_state;
|
1231
|
+
goto yy_match;
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
else
|
1235
|
+
{
|
1236
|
+
yy_cp = yyg->yy_c_buf_p;
|
1237
|
+
goto yy_find_action;
|
1238
|
+
}
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
else switch ( yy_get_next_buffer( yyscanner ) )
|
1242
|
+
{
|
1243
|
+
case EOB_ACT_END_OF_FILE:
|
1244
|
+
{
|
1245
|
+
yyg->yy_did_buffer_switch_on_eof = 0;
|
1246
|
+
|
1247
|
+
if ( langscan_php_lex_wrap(yyscanner ) )
|
1248
|
+
{
|
1249
|
+
/* Note: because we've taken care in
|
1250
|
+
* yy_get_next_buffer() to have set up
|
1251
|
+
* yytext, we can now set up
|
1252
|
+
* yy_c_buf_p so that if some total
|
1253
|
+
* hoser (like flex itself) wants to
|
1254
|
+
* call the scanner after we return the
|
1255
|
+
* YY_NULL, it'll still work - another
|
1256
|
+
* YY_NULL will get returned.
|
1257
|
+
*/
|
1258
|
+
yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
|
1259
|
+
|
1260
|
+
yy_act = YY_STATE_EOF(YY_START);
|
1261
|
+
goto do_action;
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
else
|
1265
|
+
{
|
1266
|
+
if ( ! yyg->yy_did_buffer_switch_on_eof )
|
1267
|
+
YY_NEW_FILE;
|
1268
|
+
}
|
1269
|
+
break;
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
case EOB_ACT_CONTINUE_SCAN:
|
1273
|
+
yyg->yy_c_buf_p =
|
1274
|
+
yyg->yytext_ptr + yy_amount_of_matched_text;
|
1275
|
+
|
1276
|
+
yy_current_state = yy_get_previous_state( yyscanner );
|
1277
|
+
|
1278
|
+
yy_cp = yyg->yy_c_buf_p;
|
1279
|
+
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
|
1280
|
+
goto yy_match;
|
1281
|
+
|
1282
|
+
case EOB_ACT_LAST_MATCH:
|
1283
|
+
yyg->yy_c_buf_p =
|
1284
|
+
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
|
1285
|
+
|
1286
|
+
yy_current_state = yy_get_previous_state( yyscanner );
|
1287
|
+
|
1288
|
+
yy_cp = yyg->yy_c_buf_p;
|
1289
|
+
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
|
1290
|
+
goto yy_find_action;
|
1291
|
+
}
|
1292
|
+
break;
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
default:
|
1296
|
+
YY_FATAL_ERROR(
|
1297
|
+
"fatal flex scanner internal error--no action found" );
|
1298
|
+
} /* end of action switch */
|
1299
|
+
} /* end of scanning one token */
|
1300
|
+
} /* end of langscan_php_lex_lex */
|
1301
|
+
|
1302
|
+
/* yy_get_next_buffer - try to read in a new buffer
|
1303
|
+
*
|
1304
|
+
* Returns a code representing an action:
|
1305
|
+
* EOB_ACT_LAST_MATCH -
|
1306
|
+
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
|
1307
|
+
* EOB_ACT_END_OF_FILE - end of file
|
1308
|
+
*/
|
1309
|
+
static int yy_get_next_buffer (yyscan_t yyscanner)
|
1310
|
+
{
|
1311
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1312
|
+
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
1313
|
+
register char *source = yyg->yytext_ptr;
|
1314
|
+
register int number_to_move, i;
|
1315
|
+
int ret_val;
|
1316
|
+
|
1317
|
+
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
|
1318
|
+
YY_FATAL_ERROR(
|
1319
|
+
"fatal flex scanner internal error--end of buffer missed" );
|
1320
|
+
|
1321
|
+
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
|
1322
|
+
{ /* Don't try to fill the buffer, so this is an EOF. */
|
1323
|
+
if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
|
1324
|
+
{
|
1325
|
+
/* We matched a single character, the EOB, so
|
1326
|
+
* treat this as a final EOF.
|
1327
|
+
*/
|
1328
|
+
return EOB_ACT_END_OF_FILE;
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
else
|
1332
|
+
{
|
1333
|
+
/* We matched some text prior to the EOB, first
|
1334
|
+
* process it.
|
1335
|
+
*/
|
1336
|
+
return EOB_ACT_LAST_MATCH;
|
1337
|
+
}
|
1338
|
+
}
|
1339
|
+
|
1340
|
+
/* Try to read more data. */
|
1341
|
+
|
1342
|
+
/* First move last chars to start of buffer. */
|
1343
|
+
number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
|
1344
|
+
|
1345
|
+
for ( i = 0; i < number_to_move; ++i )
|
1346
|
+
*(dest++) = *(source++);
|
1347
|
+
|
1348
|
+
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
|
1349
|
+
/* don't do the read, it's not guaranteed to return an EOF,
|
1350
|
+
* just force an EOF
|
1351
|
+
*/
|
1352
|
+
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
|
1353
|
+
|
1354
|
+
else
|
1355
|
+
{
|
1356
|
+
yy_size_t num_to_read =
|
1357
|
+
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
1358
|
+
|
1359
|
+
while ( num_to_read <= 0 )
|
1360
|
+
{ /* Not enough room in the buffer - grow it. */
|
1361
|
+
|
1362
|
+
/* just a shorter name for the current buffer */
|
1363
|
+
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
|
1364
|
+
|
1365
|
+
int yy_c_buf_p_offset =
|
1366
|
+
(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
|
1367
|
+
|
1368
|
+
if ( b->yy_is_our_buffer )
|
1369
|
+
{
|
1370
|
+
yy_size_t new_size = b->yy_buf_size * 2;
|
1371
|
+
|
1372
|
+
if ( new_size <= 0 )
|
1373
|
+
b->yy_buf_size += b->yy_buf_size / 8;
|
1374
|
+
else
|
1375
|
+
b->yy_buf_size *= 2;
|
1376
|
+
|
1377
|
+
b->yy_ch_buf = (char *)
|
1378
|
+
/* Include room in for 2 EOB chars. */
|
1379
|
+
langscan_php_lex_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
|
1380
|
+
}
|
1381
|
+
else
|
1382
|
+
/* Can't grow it, we don't own it. */
|
1383
|
+
b->yy_ch_buf = 0;
|
1384
|
+
|
1385
|
+
if ( ! b->yy_ch_buf )
|
1386
|
+
YY_FATAL_ERROR(
|
1387
|
+
"fatal error - scanner input buffer overflow" );
|
1388
|
+
|
1389
|
+
yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
|
1390
|
+
|
1391
|
+
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
|
1392
|
+
number_to_move - 1;
|
1393
|
+
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
if ( num_to_read > YY_READ_BUF_SIZE )
|
1397
|
+
num_to_read = YY_READ_BUF_SIZE;
|
1398
|
+
|
1399
|
+
/* Read in more data. */
|
1400
|
+
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
1401
|
+
yyg->yy_n_chars, num_to_read );
|
1402
|
+
|
1403
|
+
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
if ( yyg->yy_n_chars == 0 )
|
1407
|
+
{
|
1408
|
+
if ( number_to_move == YY_MORE_ADJ )
|
1409
|
+
{
|
1410
|
+
ret_val = EOB_ACT_END_OF_FILE;
|
1411
|
+
langscan_php_lex_restart(yyin ,yyscanner);
|
1412
|
+
}
|
1413
|
+
|
1414
|
+
else
|
1415
|
+
{
|
1416
|
+
ret_val = EOB_ACT_LAST_MATCH;
|
1417
|
+
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
|
1418
|
+
YY_BUFFER_EOF_PENDING;
|
1419
|
+
}
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
else
|
1423
|
+
ret_val = EOB_ACT_CONTINUE_SCAN;
|
1424
|
+
|
1425
|
+
if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
|
1426
|
+
/* Extend the array by 50%, plus the number we really need. */
|
1427
|
+
yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
|
1428
|
+
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) langscan_php_lex_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
|
1429
|
+
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
1430
|
+
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
|
1431
|
+
}
|
1432
|
+
|
1433
|
+
yyg->yy_n_chars += number_to_move;
|
1434
|
+
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
|
1435
|
+
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
|
1436
|
+
|
1437
|
+
yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
|
1438
|
+
|
1439
|
+
return ret_val;
|
1440
|
+
}
|
1441
|
+
|
1442
|
+
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
1443
|
+
|
1444
|
+
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
|
1445
|
+
{
|
1446
|
+
register yy_state_type yy_current_state;
|
1447
|
+
register char *yy_cp;
|
1448
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1449
|
+
|
1450
|
+
yy_current_state = yyg->yy_start;
|
1451
|
+
|
1452
|
+
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
|
1453
|
+
{
|
1454
|
+
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
1455
|
+
if ( yy_accept[yy_current_state] )
|
1456
|
+
{
|
1457
|
+
yyg->yy_last_accepting_state = yy_current_state;
|
1458
|
+
yyg->yy_last_accepting_cpos = yy_cp;
|
1459
|
+
}
|
1460
|
+
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
1461
|
+
{
|
1462
|
+
yy_current_state = (int) yy_def[yy_current_state];
|
1463
|
+
if ( yy_current_state >= 179 )
|
1464
|
+
yy_c = yy_meta[(unsigned int) yy_c];
|
1465
|
+
}
|
1466
|
+
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
return yy_current_state;
|
1470
|
+
}
|
1471
|
+
|
1472
|
+
/* yy_try_NUL_trans - try to make a transition on the NUL character
|
1473
|
+
*
|
1474
|
+
* synopsis
|
1475
|
+
* next_state = yy_try_NUL_trans( current_state );
|
1476
|
+
*/
|
1477
|
+
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
|
1478
|
+
{
|
1479
|
+
register int yy_is_jam;
|
1480
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
|
1481
|
+
register char *yy_cp = yyg->yy_c_buf_p;
|
1482
|
+
|
1483
|
+
register YY_CHAR yy_c = 1;
|
1484
|
+
if ( yy_accept[yy_current_state] )
|
1485
|
+
{
|
1486
|
+
yyg->yy_last_accepting_state = yy_current_state;
|
1487
|
+
yyg->yy_last_accepting_cpos = yy_cp;
|
1488
|
+
}
|
1489
|
+
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
1490
|
+
{
|
1491
|
+
yy_current_state = (int) yy_def[yy_current_state];
|
1492
|
+
if ( yy_current_state >= 179 )
|
1493
|
+
yy_c = yy_meta[(unsigned int) yy_c];
|
1494
|
+
}
|
1495
|
+
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
1496
|
+
yy_is_jam = (yy_current_state == 178);
|
1497
|
+
|
1498
|
+
return yy_is_jam ? 0 : yy_current_state;
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
|
1502
|
+
{
|
1503
|
+
register char *yy_cp;
|
1504
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1505
|
+
|
1506
|
+
yy_cp = yyg->yy_c_buf_p;
|
1507
|
+
|
1508
|
+
/* undo effects of setting up yytext */
|
1509
|
+
*yy_cp = yyg->yy_hold_char;
|
1510
|
+
|
1511
|
+
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
|
1512
|
+
{ /* need to shift things up to make room */
|
1513
|
+
/* +2 for EOB chars. */
|
1514
|
+
register yy_size_t number_to_move = yyg->yy_n_chars + 2;
|
1515
|
+
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
|
1516
|
+
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
|
1517
|
+
register char *source =
|
1518
|
+
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
|
1519
|
+
|
1520
|
+
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
1521
|
+
*--dest = *--source;
|
1522
|
+
|
1523
|
+
yy_cp += (int) (dest - source);
|
1524
|
+
yy_bp += (int) (dest - source);
|
1525
|
+
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
|
1526
|
+
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
|
1527
|
+
|
1528
|
+
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
|
1529
|
+
YY_FATAL_ERROR( "flex scanner push-back overflow" );
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
*--yy_cp = (char) c;
|
1533
|
+
|
1534
|
+
yyg->yytext_ptr = yy_bp;
|
1535
|
+
yyg->yy_hold_char = *yy_cp;
|
1536
|
+
yyg->yy_c_buf_p = yy_cp;
|
1537
|
+
}
|
1538
|
+
|
1539
|
+
#ifndef YY_NO_INPUT
|
1540
|
+
#ifdef __cplusplus
|
1541
|
+
static int yyinput (yyscan_t yyscanner)
|
1542
|
+
#else
|
1543
|
+
static int input (yyscan_t yyscanner)
|
1544
|
+
#endif
|
1545
|
+
|
1546
|
+
{
|
1547
|
+
int c;
|
1548
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1549
|
+
|
1550
|
+
*yyg->yy_c_buf_p = yyg->yy_hold_char;
|
1551
|
+
|
1552
|
+
if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
|
1553
|
+
{
|
1554
|
+
/* yy_c_buf_p now points to the character we want to return.
|
1555
|
+
* If this occurs *before* the EOB characters, then it's a
|
1556
|
+
* valid NUL; if not, then we've hit the end of the buffer.
|
1557
|
+
*/
|
1558
|
+
if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
|
1559
|
+
/* This was really a NUL. */
|
1560
|
+
*yyg->yy_c_buf_p = '\0';
|
1561
|
+
|
1562
|
+
else
|
1563
|
+
{ /* need more input */
|
1564
|
+
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
|
1565
|
+
++yyg->yy_c_buf_p;
|
1566
|
+
|
1567
|
+
switch ( yy_get_next_buffer( yyscanner ) )
|
1568
|
+
{
|
1569
|
+
case EOB_ACT_LAST_MATCH:
|
1570
|
+
/* This happens because yy_g_n_b()
|
1571
|
+
* sees that we've accumulated a
|
1572
|
+
* token and flags that we need to
|
1573
|
+
* try matching the token before
|
1574
|
+
* proceeding. But for input(),
|
1575
|
+
* there's no matching to consider.
|
1576
|
+
* So convert the EOB_ACT_LAST_MATCH
|
1577
|
+
* to EOB_ACT_END_OF_FILE.
|
1578
|
+
*/
|
1579
|
+
|
1580
|
+
/* Reset buffer status. */
|
1581
|
+
langscan_php_lex_restart(yyin ,yyscanner);
|
1582
|
+
|
1583
|
+
/*FALLTHROUGH*/
|
1584
|
+
|
1585
|
+
case EOB_ACT_END_OF_FILE:
|
1586
|
+
{
|
1587
|
+
if ( langscan_php_lex_wrap(yyscanner ) )
|
1588
|
+
return 0;
|
1589
|
+
|
1590
|
+
if ( ! yyg->yy_did_buffer_switch_on_eof )
|
1591
|
+
YY_NEW_FILE;
|
1592
|
+
#ifdef __cplusplus
|
1593
|
+
return yyinput(yyscanner);
|
1594
|
+
#else
|
1595
|
+
return input(yyscanner);
|
1596
|
+
#endif
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
case EOB_ACT_CONTINUE_SCAN:
|
1600
|
+
yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
|
1601
|
+
break;
|
1602
|
+
}
|
1603
|
+
}
|
1604
|
+
}
|
1605
|
+
|
1606
|
+
c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
|
1607
|
+
*yyg->yy_c_buf_p = '\0'; /* preserve yytext */
|
1608
|
+
yyg->yy_hold_char = *++yyg->yy_c_buf_p;
|
1609
|
+
|
1610
|
+
return c;
|
1611
|
+
}
|
1612
|
+
#endif /* ifndef YY_NO_INPUT */
|
1613
|
+
|
1614
|
+
/** Immediately switch to a different input stream.
|
1615
|
+
* @param input_file A readable stream.
|
1616
|
+
* @param yyscanner The scanner object.
|
1617
|
+
* @note This function does not reset the start condition to @c INITIAL .
|
1618
|
+
*/
|
1619
|
+
void langscan_php_lex_restart (FILE * input_file , yyscan_t yyscanner)
|
1620
|
+
{
|
1621
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1622
|
+
|
1623
|
+
if ( ! YY_CURRENT_BUFFER ){
|
1624
|
+
langscan_php_lex_ensure_buffer_stack (yyscanner);
|
1625
|
+
YY_CURRENT_BUFFER_LVALUE =
|
1626
|
+
langscan_php_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
|
1627
|
+
}
|
1628
|
+
|
1629
|
+
langscan_php_lex__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
|
1630
|
+
langscan_php_lex__load_buffer_state(yyscanner );
|
1631
|
+
}
|
1632
|
+
|
1633
|
+
/** Switch to a different input buffer.
|
1634
|
+
* @param new_buffer The new input buffer.
|
1635
|
+
* @param yyscanner The scanner object.
|
1636
|
+
*/
|
1637
|
+
void langscan_php_lex__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
|
1638
|
+
{
|
1639
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1640
|
+
|
1641
|
+
/* TODO. We should be able to replace this entire function body
|
1642
|
+
* with
|
1643
|
+
* langscan_php_lex_pop_buffer_state();
|
1644
|
+
* langscan_php_lex_push_buffer_state(new_buffer);
|
1645
|
+
*/
|
1646
|
+
langscan_php_lex_ensure_buffer_stack (yyscanner);
|
1647
|
+
if ( YY_CURRENT_BUFFER == new_buffer )
|
1648
|
+
return;
|
1649
|
+
|
1650
|
+
if ( YY_CURRENT_BUFFER )
|
1651
|
+
{
|
1652
|
+
/* Flush out information for old buffer. */
|
1653
|
+
*yyg->yy_c_buf_p = yyg->yy_hold_char;
|
1654
|
+
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
|
1655
|
+
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
YY_CURRENT_BUFFER_LVALUE = new_buffer;
|
1659
|
+
langscan_php_lex__load_buffer_state(yyscanner );
|
1660
|
+
|
1661
|
+
/* We don't actually know whether we did this switch during
|
1662
|
+
* EOF (langscan_php_lex_wrap()) processing, but the only time this flag
|
1663
|
+
* is looked at is after langscan_php_lex_wrap() is called, so it's safe
|
1664
|
+
* to go ahead and always set it.
|
1665
|
+
*/
|
1666
|
+
yyg->yy_did_buffer_switch_on_eof = 1;
|
1667
|
+
}
|
1668
|
+
|
1669
|
+
static void langscan_php_lex__load_buffer_state (yyscan_t yyscanner)
|
1670
|
+
{
|
1671
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1672
|
+
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
|
1673
|
+
yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
|
1674
|
+
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
|
1675
|
+
yyg->yy_hold_char = *yyg->yy_c_buf_p;
|
1676
|
+
}
|
1677
|
+
|
1678
|
+
/** Allocate and initialize an input buffer state.
|
1679
|
+
* @param file A readable stream.
|
1680
|
+
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
|
1681
|
+
* @param yyscanner The scanner object.
|
1682
|
+
* @return the allocated buffer state.
|
1683
|
+
*/
|
1684
|
+
YY_BUFFER_STATE langscan_php_lex__create_buffer (FILE * file, int size , yyscan_t yyscanner)
|
1685
|
+
{
|
1686
|
+
YY_BUFFER_STATE b;
|
1687
|
+
|
1688
|
+
b = (YY_BUFFER_STATE) langscan_php_lex_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
|
1689
|
+
if ( ! b )
|
1690
|
+
YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__create_buffer()" );
|
1691
|
+
|
1692
|
+
b->yy_buf_size = size;
|
1693
|
+
|
1694
|
+
/* yy_ch_buf has to be 2 characters longer than the size given because
|
1695
|
+
* we need to put in 2 end-of-buffer characters.
|
1696
|
+
*/
|
1697
|
+
b->yy_ch_buf = (char *) langscan_php_lex_alloc(b->yy_buf_size + 2 ,yyscanner );
|
1698
|
+
if ( ! b->yy_ch_buf )
|
1699
|
+
YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__create_buffer()" );
|
1700
|
+
|
1701
|
+
b->yy_is_our_buffer = 1;
|
1702
|
+
|
1703
|
+
langscan_php_lex__init_buffer(b,file ,yyscanner);
|
1704
|
+
|
1705
|
+
return b;
|
1706
|
+
}
|
1707
|
+
|
1708
|
+
/** Destroy the buffer.
|
1709
|
+
* @param b a buffer created with langscan_php_lex__create_buffer()
|
1710
|
+
* @param yyscanner The scanner object.
|
1711
|
+
*/
|
1712
|
+
void langscan_php_lex__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
|
1713
|
+
{
|
1714
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1715
|
+
|
1716
|
+
if ( ! b )
|
1717
|
+
return;
|
1718
|
+
|
1719
|
+
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
|
1720
|
+
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
|
1721
|
+
|
1722
|
+
if ( b->yy_is_our_buffer )
|
1723
|
+
langscan_php_lex_free((void *) b->yy_ch_buf ,yyscanner );
|
1724
|
+
|
1725
|
+
langscan_php_lex_free((void *) b ,yyscanner );
|
1726
|
+
}
|
1727
|
+
|
1728
|
+
#ifndef __cplusplus
|
1729
|
+
extern int isatty (int );
|
1730
|
+
#endif /* __cplusplus */
|
1731
|
+
|
1732
|
+
/* Initializes or reinitializes a buffer.
|
1733
|
+
* This function is sometimes called more than once on the same buffer,
|
1734
|
+
* such as during a langscan_php_lex_restart() or at EOF.
|
1735
|
+
*/
|
1736
|
+
static void langscan_php_lex__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
|
1737
|
+
|
1738
|
+
{
|
1739
|
+
int oerrno = errno;
|
1740
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1741
|
+
|
1742
|
+
langscan_php_lex__flush_buffer(b ,yyscanner);
|
1743
|
+
|
1744
|
+
b->yy_input_file = file;
|
1745
|
+
b->yy_fill_buffer = 1;
|
1746
|
+
|
1747
|
+
/* If b is the current buffer, then langscan_php_lex__init_buffer was _probably_
|
1748
|
+
* called from langscan_php_lex_restart() or through yy_get_next_buffer.
|
1749
|
+
* In that case, we don't want to reset the lineno or column.
|
1750
|
+
*/
|
1751
|
+
if (b != YY_CURRENT_BUFFER){
|
1752
|
+
b->yy_bs_lineno = 1;
|
1753
|
+
b->yy_bs_column = 0;
|
1754
|
+
}
|
1755
|
+
|
1756
|
+
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
|
1757
|
+
|
1758
|
+
errno = oerrno;
|
1759
|
+
}
|
1760
|
+
|
1761
|
+
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
|
1762
|
+
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
|
1763
|
+
* @param yyscanner The scanner object.
|
1764
|
+
*/
|
1765
|
+
void langscan_php_lex__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
|
1766
|
+
{
|
1767
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1768
|
+
if ( ! b )
|
1769
|
+
return;
|
1770
|
+
|
1771
|
+
b->yy_n_chars = 0;
|
1772
|
+
|
1773
|
+
/* We always need two end-of-buffer characters. The first causes
|
1774
|
+
* a transition to the end-of-buffer state. The second causes
|
1775
|
+
* a jam in that state.
|
1776
|
+
*/
|
1777
|
+
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
|
1778
|
+
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
|
1779
|
+
|
1780
|
+
b->yy_buf_pos = &b->yy_ch_buf[0];
|
1781
|
+
|
1782
|
+
b->yy_at_bol = 1;
|
1783
|
+
b->yy_buffer_status = YY_BUFFER_NEW;
|
1784
|
+
|
1785
|
+
if ( b == YY_CURRENT_BUFFER )
|
1786
|
+
langscan_php_lex__load_buffer_state(yyscanner );
|
1787
|
+
}
|
1788
|
+
|
1789
|
+
/** Pushes the new state onto the stack. The new state becomes
|
1790
|
+
* the current state. This function will allocate the stack
|
1791
|
+
* if necessary.
|
1792
|
+
* @param new_buffer The new state.
|
1793
|
+
* @param yyscanner The scanner object.
|
1794
|
+
*/
|
1795
|
+
void langscan_php_lex_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
|
1796
|
+
{
|
1797
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1798
|
+
if (new_buffer == NULL)
|
1799
|
+
return;
|
1800
|
+
|
1801
|
+
langscan_php_lex_ensure_buffer_stack(yyscanner);
|
1802
|
+
|
1803
|
+
/* This block is copied from langscan_php_lex__switch_to_buffer. */
|
1804
|
+
if ( YY_CURRENT_BUFFER )
|
1805
|
+
{
|
1806
|
+
/* Flush out information for old buffer. */
|
1807
|
+
*yyg->yy_c_buf_p = yyg->yy_hold_char;
|
1808
|
+
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
|
1809
|
+
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
|
1810
|
+
}
|
1811
|
+
|
1812
|
+
/* Only push if top exists. Otherwise, replace top. */
|
1813
|
+
if (YY_CURRENT_BUFFER)
|
1814
|
+
yyg->yy_buffer_stack_top++;
|
1815
|
+
YY_CURRENT_BUFFER_LVALUE = new_buffer;
|
1816
|
+
|
1817
|
+
/* copied from langscan_php_lex__switch_to_buffer. */
|
1818
|
+
langscan_php_lex__load_buffer_state(yyscanner );
|
1819
|
+
yyg->yy_did_buffer_switch_on_eof = 1;
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
/** Removes and deletes the top of the stack, if present.
|
1823
|
+
* The next element becomes the new top.
|
1824
|
+
* @param yyscanner The scanner object.
|
1825
|
+
*/
|
1826
|
+
void langscan_php_lex_pop_buffer_state (yyscan_t yyscanner)
|
1827
|
+
{
|
1828
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1829
|
+
if (!YY_CURRENT_BUFFER)
|
1830
|
+
return;
|
1831
|
+
|
1832
|
+
langscan_php_lex__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
|
1833
|
+
YY_CURRENT_BUFFER_LVALUE = NULL;
|
1834
|
+
if (yyg->yy_buffer_stack_top > 0)
|
1835
|
+
--yyg->yy_buffer_stack_top;
|
1836
|
+
|
1837
|
+
if (YY_CURRENT_BUFFER) {
|
1838
|
+
langscan_php_lex__load_buffer_state(yyscanner );
|
1839
|
+
yyg->yy_did_buffer_switch_on_eof = 1;
|
1840
|
+
}
|
1841
|
+
}
|
1842
|
+
|
1843
|
+
/* Allocates the stack if it does not exist.
|
1844
|
+
* Guarantees space for at least one push.
|
1845
|
+
*/
|
1846
|
+
static void langscan_php_lex_ensure_buffer_stack (yyscan_t yyscanner)
|
1847
|
+
{
|
1848
|
+
yy_size_t num_to_alloc;
|
1849
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
1850
|
+
|
1851
|
+
if (!yyg->yy_buffer_stack) {
|
1852
|
+
|
1853
|
+
/* First allocation is just for 2 elements, since we don't know if this
|
1854
|
+
* scanner will even need a stack. We use 2 instead of 1 to avoid an
|
1855
|
+
* immediate realloc on the next call.
|
1856
|
+
*/
|
1857
|
+
num_to_alloc = 1;
|
1858
|
+
yyg->yy_buffer_stack = (struct yy_buffer_state**)langscan_php_lex_alloc
|
1859
|
+
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
1860
|
+
, yyscanner);
|
1861
|
+
if ( ! yyg->yy_buffer_stack )
|
1862
|
+
YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex_ensure_buffer_stack()" );
|
1863
|
+
|
1864
|
+
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
1865
|
+
|
1866
|
+
yyg->yy_buffer_stack_max = num_to_alloc;
|
1867
|
+
yyg->yy_buffer_stack_top = 0;
|
1868
|
+
return;
|
1869
|
+
}
|
1870
|
+
|
1871
|
+
if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
|
1872
|
+
|
1873
|
+
/* Increase the buffer to prepare for a possible push. */
|
1874
|
+
int grow_size = 8 /* arbitrary grow size */;
|
1875
|
+
|
1876
|
+
num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
|
1877
|
+
yyg->yy_buffer_stack = (struct yy_buffer_state**)langscan_php_lex_realloc
|
1878
|
+
(yyg->yy_buffer_stack,
|
1879
|
+
num_to_alloc * sizeof(struct yy_buffer_state*)
|
1880
|
+
, yyscanner);
|
1881
|
+
if ( ! yyg->yy_buffer_stack )
|
1882
|
+
YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex_ensure_buffer_stack()" );
|
1883
|
+
|
1884
|
+
/* zero only the new slots.*/
|
1885
|
+
memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
|
1886
|
+
yyg->yy_buffer_stack_max = num_to_alloc;
|
1887
|
+
}
|
1888
|
+
}
|
1889
|
+
|
1890
|
+
/** Setup the input buffer state to scan directly from a user-specified character buffer.
|
1891
|
+
* @param base the character buffer
|
1892
|
+
* @param size the size in bytes of the character buffer
|
1893
|
+
* @param yyscanner The scanner object.
|
1894
|
+
* @return the newly allocated buffer state object.
|
1895
|
+
*/
|
1896
|
+
YY_BUFFER_STATE langscan_php_lex__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
|
1897
|
+
{
|
1898
|
+
YY_BUFFER_STATE b;
|
1899
|
+
|
1900
|
+
if ( size < 2 ||
|
1901
|
+
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
1902
|
+
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
1903
|
+
/* They forgot to leave room for the EOB's. */
|
1904
|
+
return 0;
|
1905
|
+
|
1906
|
+
b = (YY_BUFFER_STATE) langscan_php_lex_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
|
1907
|
+
if ( ! b )
|
1908
|
+
YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__scan_buffer()" );
|
1909
|
+
|
1910
|
+
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
|
1911
|
+
b->yy_buf_pos = b->yy_ch_buf = base;
|
1912
|
+
b->yy_is_our_buffer = 0;
|
1913
|
+
b->yy_input_file = 0;
|
1914
|
+
b->yy_n_chars = b->yy_buf_size;
|
1915
|
+
b->yy_is_interactive = 0;
|
1916
|
+
b->yy_at_bol = 1;
|
1917
|
+
b->yy_fill_buffer = 0;
|
1918
|
+
b->yy_buffer_status = YY_BUFFER_NEW;
|
1919
|
+
|
1920
|
+
langscan_php_lex__switch_to_buffer(b ,yyscanner );
|
1921
|
+
|
1922
|
+
return b;
|
1923
|
+
}
|
1924
|
+
|
1925
|
+
/** Setup the input buffer state to scan a string. The next call to langscan_php_lex_lex() will
|
1926
|
+
* scan from a @e copy of @a str.
|
1927
|
+
* @param yystr a NUL-terminated string to scan
|
1928
|
+
* @param yyscanner The scanner object.
|
1929
|
+
* @return the newly allocated buffer state object.
|
1930
|
+
* @note If you want to scan bytes that may contain NUL values, then use
|
1931
|
+
* langscan_php_lex__scan_bytes() instead.
|
1932
|
+
*/
|
1933
|
+
YY_BUFFER_STATE langscan_php_lex__scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
1934
|
+
{
|
1935
|
+
|
1936
|
+
return langscan_php_lex__scan_bytes(yystr,strlen(yystr) ,yyscanner);
|
1937
|
+
}
|
1938
|
+
|
1939
|
+
/** Setup the input buffer state to scan the given bytes. The next call to langscan_php_lex_lex() will
|
1940
|
+
* scan from a @e copy of @a bytes.
|
1941
|
+
* @param bytes the byte buffer to scan
|
1942
|
+
* @param len the number of bytes in the buffer pointed to by @a bytes.
|
1943
|
+
* @param yyscanner The scanner object.
|
1944
|
+
* @return the newly allocated buffer state object.
|
1945
|
+
*/
|
1946
|
+
YY_BUFFER_STATE langscan_php_lex__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
|
1947
|
+
{
|
1948
|
+
YY_BUFFER_STATE b;
|
1949
|
+
char *buf;
|
1950
|
+
yy_size_t n, i;
|
1951
|
+
|
1952
|
+
/* Get memory for full buffer, including space for trailing EOB's. */
|
1953
|
+
n = _yybytes_len + 2;
|
1954
|
+
buf = (char *) langscan_php_lex_alloc(n ,yyscanner );
|
1955
|
+
if ( ! buf )
|
1956
|
+
YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__scan_bytes()" );
|
1957
|
+
|
1958
|
+
for ( i = 0; i < _yybytes_len; ++i )
|
1959
|
+
buf[i] = yybytes[i];
|
1960
|
+
|
1961
|
+
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
|
1962
|
+
|
1963
|
+
b = langscan_php_lex__scan_buffer(buf,n ,yyscanner);
|
1964
|
+
if ( ! b )
|
1965
|
+
YY_FATAL_ERROR( "bad buffer in langscan_php_lex__scan_bytes()" );
|
1966
|
+
|
1967
|
+
/* It's okay to grow etc. this buffer, and we should throw it
|
1968
|
+
* away when we're done.
|
1969
|
+
*/
|
1970
|
+
b->yy_is_our_buffer = 1;
|
1971
|
+
|
1972
|
+
return b;
|
1973
|
+
}
|
1974
|
+
|
1975
|
+
#ifndef YY_EXIT_FAILURE
|
1976
|
+
#define YY_EXIT_FAILURE 2
|
1977
|
+
#endif
|
1978
|
+
|
1979
|
+
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
|
1980
|
+
{
|
1981
|
+
(void) fprintf( stderr, "%s\n", msg );
|
1982
|
+
exit( YY_EXIT_FAILURE );
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
/* Redefine yyless() so it works in section 3 code. */
|
1986
|
+
|
1987
|
+
#undef yyless
|
1988
|
+
#define yyless(n) \
|
1989
|
+
do \
|
1990
|
+
{ \
|
1991
|
+
/* Undo effects of setting up yytext. */ \
|
1992
|
+
int yyless_macro_arg = (n); \
|
1993
|
+
YY_LESS_LINENO(yyless_macro_arg);\
|
1994
|
+
yytext[yyleng] = yyg->yy_hold_char; \
|
1995
|
+
yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
|
1996
|
+
yyg->yy_hold_char = *yyg->yy_c_buf_p; \
|
1997
|
+
*yyg->yy_c_buf_p = '\0'; \
|
1998
|
+
yyleng = yyless_macro_arg; \
|
1999
|
+
} \
|
2000
|
+
while ( 0 )
|
2001
|
+
|
2002
|
+
/* Accessor methods (get/set functions) to struct members. */
|
2003
|
+
|
2004
|
+
/** Get the user-defined data for this scanner.
|
2005
|
+
* @param yyscanner The scanner object.
|
2006
|
+
*/
|
2007
|
+
YY_EXTRA_TYPE langscan_php_lex_get_extra (yyscan_t yyscanner)
|
2008
|
+
{
|
2009
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2010
|
+
return yyextra;
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
/** Get the current line number.
|
2014
|
+
* @param yyscanner The scanner object.
|
2015
|
+
*/
|
2016
|
+
int langscan_php_lex_get_lineno (yyscan_t yyscanner)
|
2017
|
+
{
|
2018
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2019
|
+
|
2020
|
+
if (! YY_CURRENT_BUFFER)
|
2021
|
+
return 0;
|
2022
|
+
|
2023
|
+
return yylineno;
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
/** Get the current column number.
|
2027
|
+
* @param yyscanner The scanner object.
|
2028
|
+
*/
|
2029
|
+
int langscan_php_lex_get_column (yyscan_t yyscanner)
|
2030
|
+
{
|
2031
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2032
|
+
|
2033
|
+
if (! YY_CURRENT_BUFFER)
|
2034
|
+
return 0;
|
2035
|
+
|
2036
|
+
return yycolumn;
|
2037
|
+
}
|
2038
|
+
|
2039
|
+
/** Get the input stream.
|
2040
|
+
* @param yyscanner The scanner object.
|
2041
|
+
*/
|
2042
|
+
FILE *langscan_php_lex_get_in (yyscan_t yyscanner)
|
2043
|
+
{
|
2044
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2045
|
+
return yyin;
|
2046
|
+
}
|
2047
|
+
|
2048
|
+
/** Get the output stream.
|
2049
|
+
* @param yyscanner The scanner object.
|
2050
|
+
*/
|
2051
|
+
FILE *langscan_php_lex_get_out (yyscan_t yyscanner)
|
2052
|
+
{
|
2053
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2054
|
+
return yyout;
|
2055
|
+
}
|
2056
|
+
|
2057
|
+
/** Get the length of the current token.
|
2058
|
+
* @param yyscanner The scanner object.
|
2059
|
+
*/
|
2060
|
+
yy_size_t langscan_php_lex_get_leng (yyscan_t yyscanner)
|
2061
|
+
{
|
2062
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2063
|
+
return yyleng;
|
2064
|
+
}
|
2065
|
+
|
2066
|
+
/** Get the current token.
|
2067
|
+
* @param yyscanner The scanner object.
|
2068
|
+
*/
|
2069
|
+
|
2070
|
+
char *langscan_php_lex_get_text (yyscan_t yyscanner)
|
2071
|
+
{
|
2072
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2073
|
+
return yytext;
|
2074
|
+
}
|
2075
|
+
|
2076
|
+
/** Set the user-defined data. This data is never touched by the scanner.
|
2077
|
+
* @param user_defined The data to be associated with this scanner.
|
2078
|
+
* @param yyscanner The scanner object.
|
2079
|
+
*/
|
2080
|
+
void langscan_php_lex_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
|
2081
|
+
{
|
2082
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2083
|
+
yyextra = user_defined ;
|
2084
|
+
}
|
2085
|
+
|
2086
|
+
/** Set the current line number.
|
2087
|
+
* @param line_number
|
2088
|
+
* @param yyscanner The scanner object.
|
2089
|
+
*/
|
2090
|
+
void langscan_php_lex_set_lineno (int line_number , yyscan_t yyscanner)
|
2091
|
+
{
|
2092
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2093
|
+
|
2094
|
+
/* lineno is only valid if an input buffer exists. */
|
2095
|
+
if (! YY_CURRENT_BUFFER )
|
2096
|
+
yy_fatal_error( "langscan_php_lex_set_lineno called with no buffer" , yyscanner);
|
2097
|
+
|
2098
|
+
yylineno = line_number;
|
2099
|
+
}
|
2100
|
+
|
2101
|
+
/** Set the current column.
|
2102
|
+
* @param line_number
|
2103
|
+
* @param yyscanner The scanner object.
|
2104
|
+
*/
|
2105
|
+
void langscan_php_lex_set_column (int column_no , yyscan_t yyscanner)
|
2106
|
+
{
|
2107
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2108
|
+
|
2109
|
+
/* column is only valid if an input buffer exists. */
|
2110
|
+
if (! YY_CURRENT_BUFFER )
|
2111
|
+
yy_fatal_error( "langscan_php_lex_set_column called with no buffer" , yyscanner);
|
2112
|
+
|
2113
|
+
yycolumn = column_no;
|
2114
|
+
}
|
2115
|
+
|
2116
|
+
/** Set the input stream. This does not discard the current
|
2117
|
+
* input buffer.
|
2118
|
+
* @param in_str A readable stream.
|
2119
|
+
* @param yyscanner The scanner object.
|
2120
|
+
* @see langscan_php_lex__switch_to_buffer
|
2121
|
+
*/
|
2122
|
+
void langscan_php_lex_set_in (FILE * in_str , yyscan_t yyscanner)
|
2123
|
+
{
|
2124
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2125
|
+
yyin = in_str ;
|
2126
|
+
}
|
2127
|
+
|
2128
|
+
void langscan_php_lex_set_out (FILE * out_str , yyscan_t yyscanner)
|
2129
|
+
{
|
2130
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2131
|
+
yyout = out_str ;
|
2132
|
+
}
|
2133
|
+
|
2134
|
+
int langscan_php_lex_get_debug (yyscan_t yyscanner)
|
2135
|
+
{
|
2136
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2137
|
+
return yy_flex_debug;
|
2138
|
+
}
|
2139
|
+
|
2140
|
+
void langscan_php_lex_set_debug (int bdebug , yyscan_t yyscanner)
|
2141
|
+
{
|
2142
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2143
|
+
yy_flex_debug = bdebug ;
|
2144
|
+
}
|
2145
|
+
|
2146
|
+
/* Accessor methods for yylval and yylloc */
|
2147
|
+
|
2148
|
+
/* User-visible API */
|
2149
|
+
|
2150
|
+
/* langscan_php_lex_lex_init is special because it creates the scanner itself, so it is
|
2151
|
+
* the ONLY reentrant function that doesn't take the scanner as the last argument.
|
2152
|
+
* That's why we explicitly handle the declaration, instead of using our macros.
|
2153
|
+
*/
|
2154
|
+
|
2155
|
+
int langscan_php_lex_lex_init(yyscan_t* ptr_yy_globals)
|
2156
|
+
|
2157
|
+
{
|
2158
|
+
if (ptr_yy_globals == NULL){
|
2159
|
+
errno = EINVAL;
|
2160
|
+
return 1;
|
2161
|
+
}
|
2162
|
+
|
2163
|
+
*ptr_yy_globals = (yyscan_t) langscan_php_lex_alloc ( sizeof( struct yyguts_t ), NULL );
|
2164
|
+
|
2165
|
+
if (*ptr_yy_globals == NULL){
|
2166
|
+
errno = ENOMEM;
|
2167
|
+
return 1;
|
2168
|
+
}
|
2169
|
+
|
2170
|
+
/* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
|
2171
|
+
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
|
2172
|
+
|
2173
|
+
return yy_init_globals ( *ptr_yy_globals );
|
2174
|
+
}
|
2175
|
+
|
2176
|
+
/* langscan_php_lex_lex_init_extra has the same functionality as langscan_php_lex_lex_init, but follows the
|
2177
|
+
* convention of taking the scanner as the last argument. Note however, that
|
2178
|
+
* this is a *pointer* to a scanner, as it will be allocated by this call (and
|
2179
|
+
* is the reason, too, why this function also must handle its own declaration).
|
2180
|
+
* The user defined value in the first argument will be available to langscan_php_lex_alloc in
|
2181
|
+
* the yyextra field.
|
2182
|
+
*/
|
2183
|
+
|
2184
|
+
int langscan_php_lex_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
|
2185
|
+
|
2186
|
+
{
|
2187
|
+
struct yyguts_t dummy_yyguts;
|
2188
|
+
|
2189
|
+
langscan_php_lex_set_extra (yy_user_defined, &dummy_yyguts);
|
2190
|
+
|
2191
|
+
if (ptr_yy_globals == NULL){
|
2192
|
+
errno = EINVAL;
|
2193
|
+
return 1;
|
2194
|
+
}
|
2195
|
+
|
2196
|
+
*ptr_yy_globals = (yyscan_t) langscan_php_lex_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
|
2197
|
+
|
2198
|
+
if (*ptr_yy_globals == NULL){
|
2199
|
+
errno = ENOMEM;
|
2200
|
+
return 1;
|
2201
|
+
}
|
2202
|
+
|
2203
|
+
/* By setting to 0xAA, we expose bugs in
|
2204
|
+
yy_init_globals. Leave at 0x00 for releases. */
|
2205
|
+
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
|
2206
|
+
|
2207
|
+
langscan_php_lex_set_extra (yy_user_defined, *ptr_yy_globals);
|
2208
|
+
|
2209
|
+
return yy_init_globals ( *ptr_yy_globals );
|
2210
|
+
}
|
2211
|
+
|
2212
|
+
static int yy_init_globals (yyscan_t yyscanner)
|
2213
|
+
{
|
2214
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2215
|
+
/* Initialization is the same as for the non-reentrant scanner.
|
2216
|
+
* This function is called from langscan_php_lex_lex_destroy(), so don't allocate here.
|
2217
|
+
*/
|
2218
|
+
|
2219
|
+
yyg->yy_buffer_stack = 0;
|
2220
|
+
yyg->yy_buffer_stack_top = 0;
|
2221
|
+
yyg->yy_buffer_stack_max = 0;
|
2222
|
+
yyg->yy_c_buf_p = (char *) 0;
|
2223
|
+
yyg->yy_init = 0;
|
2224
|
+
yyg->yy_start = 0;
|
2225
|
+
|
2226
|
+
yyg->yy_start_stack_ptr = 0;
|
2227
|
+
yyg->yy_start_stack_depth = 0;
|
2228
|
+
yyg->yy_start_stack = NULL;
|
2229
|
+
|
2230
|
+
/* Defined in main.c */
|
2231
|
+
#ifdef YY_STDINIT
|
2232
|
+
yyin = stdin;
|
2233
|
+
yyout = stdout;
|
2234
|
+
#else
|
2235
|
+
yyin = (FILE *) 0;
|
2236
|
+
yyout = (FILE *) 0;
|
2237
|
+
#endif
|
2238
|
+
|
2239
|
+
/* For future reference: Set errno on error, since we are called by
|
2240
|
+
* langscan_php_lex_lex_init()
|
2241
|
+
*/
|
2242
|
+
return 0;
|
2243
|
+
}
|
2244
|
+
|
2245
|
+
/* langscan_php_lex_lex_destroy is for both reentrant and non-reentrant scanners. */
|
2246
|
+
int langscan_php_lex_lex_destroy (yyscan_t yyscanner)
|
2247
|
+
{
|
2248
|
+
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
2249
|
+
|
2250
|
+
/* Pop the buffer stack, destroying each element. */
|
2251
|
+
while(YY_CURRENT_BUFFER){
|
2252
|
+
langscan_php_lex__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
|
2253
|
+
YY_CURRENT_BUFFER_LVALUE = NULL;
|
2254
|
+
langscan_php_lex_pop_buffer_state(yyscanner);
|
2255
|
+
}
|
2256
|
+
|
2257
|
+
/* Destroy the stack itself. */
|
2258
|
+
langscan_php_lex_free(yyg->yy_buffer_stack ,yyscanner);
|
2259
|
+
yyg->yy_buffer_stack = NULL;
|
2260
|
+
|
2261
|
+
/* Destroy the start condition stack. */
|
2262
|
+
langscan_php_lex_free(yyg->yy_start_stack ,yyscanner );
|
2263
|
+
yyg->yy_start_stack = NULL;
|
2264
|
+
|
2265
|
+
/* Reset the globals. This is important in a non-reentrant scanner so the next time
|
2266
|
+
* langscan_php_lex_lex() is called, initialization will occur. */
|
2267
|
+
yy_init_globals( yyscanner);
|
2268
|
+
|
2269
|
+
/* Destroy the main struct (reentrant only). */
|
2270
|
+
langscan_php_lex_free ( yyscanner , yyscanner );
|
2271
|
+
yyscanner = NULL;
|
2272
|
+
return 0;
|
2273
|
+
}
|
2274
|
+
|
2275
|
+
/*
|
2276
|
+
* Internal utility routines.
|
2277
|
+
*/
|
2278
|
+
|
2279
|
+
#ifndef yytext_ptr
|
2280
|
+
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
|
2281
|
+
{
|
2282
|
+
register int i;
|
2283
|
+
for ( i = 0; i < n; ++i )
|
2284
|
+
s1[i] = s2[i];
|
2285
|
+
}
|
2286
|
+
#endif
|
2287
|
+
|
2288
|
+
#ifdef YY_NEED_STRLEN
|
2289
|
+
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
|
2290
|
+
{
|
2291
|
+
register int n;
|
2292
|
+
for ( n = 0; s[n]; ++n )
|
2293
|
+
;
|
2294
|
+
|
2295
|
+
return n;
|
2296
|
+
}
|
2297
|
+
#endif
|
2298
|
+
|
2299
|
+
void *langscan_php_lex_alloc (yy_size_t size , yyscan_t yyscanner)
|
2300
|
+
{
|
2301
|
+
return (void *) malloc( size );
|
2302
|
+
}
|
2303
|
+
|
2304
|
+
void *langscan_php_lex_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
|
2305
|
+
{
|
2306
|
+
/* The cast to (char *) in the following accommodates both
|
2307
|
+
* implementations that use char* generic pointers, and those
|
2308
|
+
* that use void* generic pointers. It works with the latter
|
2309
|
+
* because both ANSI C and C++ allow castless assignment from
|
2310
|
+
* any pointer type to void*, and deal with argument conversions
|
2311
|
+
* as though doing an assignment.
|
2312
|
+
*/
|
2313
|
+
return (void *) realloc( (char *) ptr, size );
|
2314
|
+
}
|
2315
|
+
|
2316
|
+
void langscan_php_lex_free (void * ptr , yyscan_t yyscanner)
|
2317
|
+
{
|
2318
|
+
free( (char *) ptr ); /* see langscan_php_lex_realloc() for (char *) cast */
|
2319
|
+
}
|
2320
|
+
|
2321
|
+
#define YYTABLES_NAME "yytables"
|
2322
|
+
|
2323
|
+
static void update_pos(
|
2324
|
+
langscan_php_lex_extra_t *extra,
|
2325
|
+
char *text,
|
2326
|
+
int leng)
|
2327
|
+
{
|
2328
|
+
int i, j;
|
2329
|
+
extra->beg_byteno = extra->end_byteno;
|
2330
|
+
extra->beg_lineno = extra->end_lineno;
|
2331
|
+
extra->beg_columnno = extra->end_columnno;
|
2332
|
+
j = 0;
|
2333
|
+
for (i = 0; i < leng; i++) {
|
2334
|
+
if (text[i] == '\r' || (i == 0 || text[i - 1] != '\r') && text[i] == '\n') {
|
2335
|
+
extra->end_lineno++;
|
2336
|
+
j = i + 1;
|
2337
|
+
extra->end_columnno = 0;
|
2338
|
+
}
|
2339
|
+
}
|
2340
|
+
extra->end_columnno += leng - j;
|
2341
|
+
extra->end_byteno += leng;
|
2342
|
+
}
|
2343
|
+
|
2344
|
+
langscan_php_tokenizer_t *langscan_php_make_tokenizer(
|
2345
|
+
size_t (*user_read)(void **user_data_p, char *buf, size_t maxlen),
|
2346
|
+
void *user_data)
|
2347
|
+
{
|
2348
|
+
langscan_php_tokenizer_t *tokenizer;
|
2349
|
+
langscan_php_lex_extra_t *extra;
|
2350
|
+
tokenizer = (langscan_php_tokenizer_t *)malloc(sizeof(langscan_php_tokenizer_t));
|
2351
|
+
if (tokenizer == NULL)
|
2352
|
+
return NULL;
|
2353
|
+
extra = (langscan_php_lex_extra_t *)malloc(sizeof(langscan_php_lex_extra_t));
|
2354
|
+
if (extra == NULL)
|
2355
|
+
return NULL;
|
2356
|
+
extra->user_read = user_read;
|
2357
|
+
extra->user_data = user_data;
|
2358
|
+
extra->beg_lineno = 1;
|
2359
|
+
extra->beg_columnno = 0;
|
2360
|
+
extra->beg_byteno = 0;
|
2361
|
+
extra->end_lineno = 1;
|
2362
|
+
extra->end_columnno = 0;
|
2363
|
+
extra->end_byteno = 0;
|
2364
|
+
extra->eof = 0;
|
2365
|
+
tokenizer->extra = extra;
|
2366
|
+
langscan_php_lex_lex_init(&tokenizer->scanner);
|
2367
|
+
langscan_php_lex_set_extra(extra, tokenizer->scanner);
|
2368
|
+
return tokenizer;
|
2369
|
+
}
|
2370
|
+
|
2371
|
+
langscan_php_token_t langscan_php_get_token(langscan_php_tokenizer_t *tokenizer)
|
2372
|
+
{
|
2373
|
+
return langscan_php_lex_lex(tokenizer->scanner);
|
2374
|
+
}
|
2375
|
+
|
2376
|
+
void langscan_php_free_tokenizer(langscan_php_tokenizer_t *tokenizer)
|
2377
|
+
{
|
2378
|
+
langscan_php_lex_extra_t *extra = langscan_php_lex_get_extra(tokenizer->scanner);
|
2379
|
+
free((void *)extra);
|
2380
|
+
langscan_php_lex_lex_destroy(tokenizer->scanner);
|
2381
|
+
free((void *)tokenizer);
|
2382
|
+
free(heredocident);
|
2383
|
+
}
|
2384
|
+
|
2385
|
+
user_read_t langscan_php_tokenizer_get_user_read(langscan_php_tokenizer_t *tokenizer)
|
2386
|
+
{
|
2387
|
+
return tokenizer->extra->user_read;
|
2388
|
+
}
|
2389
|
+
|
2390
|
+
void *langscan_php_tokenizer_get_user_data(langscan_php_tokenizer_t *tokenizer)
|
2391
|
+
{
|
2392
|
+
return tokenizer->extra->user_data;
|
2393
|
+
}
|
2394
|
+
|
2395
|
+
const char *langscan_php_token_name(langscan_php_token_t token)
|
2396
|
+
{
|
2397
|
+
static char *token_names[] = {
|
2398
|
+
"*eof*",
|
2399
|
+
#define LANGSCAN_PHP_TOKEN(name) #name,
|
2400
|
+
LANGSCAN_PHP_TOKEN_LIST
|
2401
|
+
#undef LANGSCAN_PHP_TOKEN
|
2402
|
+
};
|
2403
|
+
|
2404
|
+
return token_names[token];
|
2405
|
+
}
|
2406
|
+
|