/*
* Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
*
* This file is part of Resin(R) Open Source
*
* Each copy or derived work must preserve the copyright notice and this
* notice unmodified.
*
* Resin Open Source is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Resin Open Source is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
* of NON-INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with Resin Open Source; if not, write to the
*
* Free Software Foundation, Inc.
* 59 Temple Place, Suite 330
* Boston, MA 02111-1307 USA
*
* @author Scott Ferguson
*/
package com.caucho.quercus.parser;
import java.io.StringReader;
import java.io.Reader;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import com.caucho.quercus.QuercusRuntimeException;
import com.caucho.quercus.expr.*;
import com.caucho.quercus.program.*;
import com.caucho.quercus.Quercus;
import com.caucho.quercus.Location;
import com.caucho.quercus.env.Env;
import com.caucho.quercus.env.Value;
import com.caucho.quercus.env.BooleanValue;
import com.caucho.quercus.env.LongValue;
import com.caucho.quercus.env.DoubleValue;
import com.caucho.quercus.env.CallbackFunction;
import com.caucho.util.IntMap;
import com.caucho.util.L10N;
import com.caucho.util.CharBuffer;
import com.caucho.vfs.IOExceptionWrapper;
import com.caucho.vfs.Vfs;
import com.caucho.vfs.Path;
import com.caucho.vfs.StringPath;
import com.caucho.vfs.ReadStream;
/**
* Parses a PHP program.
*/
public class QuercusParser {
private final static L10N L = new L10N(QuercusParser.class);
private final static int M_STATIC = 0x1;
private final static int M_PUBLIC = 0x2;
private final static int M_PROTECTED = 0x4;
private final static int M_PRIVATE = 0x8;
private final static int M_FINAL = 0x10;
private final static int M_ABSTRACT = 0x20;
private final static int M_INTERFACE = 0x40;
private final static int IDENTIFIER = 256;
private final static int STRING = 257;
private final static int LONG = 258;
private final static int DOUBLE = 259;
private final static int LSHIFT = 260;
private final static int RSHIFT = 261;
private final static int PHP_END = 262;
private final static int EQ = 263;
private final static int DEREF = 264;
private final static int LEQ = 268;
private final static int GEQ = 269;
private final static int NEQ = 270;
private final static int EQUALS = 271;
private final static int NEQUALS = 272;
private final static int C_AND = 273;
private final static int C_OR = 274;
private final static int PLUS_ASSIGN = 278;
private final static int MINUS_ASSIGN = 279;
private final static int APPEND_ASSIGN = 280;
private final static int MUL_ASSIGN = 281;
private final static int DIV_ASSIGN = 282;
private final static int MOD_ASSIGN = 283;
private final static int AND_ASSIGN = 284;
private final static int OR_ASSIGN = 285;
private final static int XOR_ASSIGN = 286;
private final static int LSHIFT_ASSIGN = 287;
private final static int RSHIFT_ASSIGN = 288;
private final static int INCR = 289;
private final static int DECR = 290;
private final static int SCOPE = 291;
private final static int ESCAPED_STRING = 292;
private final static int HEREDOC = 293;
private final static int ARRAY_RIGHT = 294;
private final static int SIMPLE_STRING_ESCAPE = 295;
private final static int COMPLEX_STRING_ESCAPE = 296;
private final static int FIRST_IDENTIFIER_LEXEME = 512;
private final static int ECHO = 512;
private final static int NULL = 513;
private final static int IF = 514;
private final static int WHILE = 515;
private final static int FUNCTION = 516;
private final static int CLASS = 517;
private final static int NEW = 518;
private final static int RETURN = 519;
private final static int VAR = 520;
private final static int PRIVATE = 521;
private final static int PROTECTED = 522;
private final static int PUBLIC = 523;
private final static int FOR = 524;
private final static int DO = 525;
private final static int BREAK = 526;
private final static int CONTINUE = 527;
private final static int ELSE = 528;
private final static int EXTENDS = 529;
private final static int STATIC = 530;
private final static int INCLUDE = 531;
private final static int REQUIRE = 532;
private final static int INCLUDE_ONCE = 533;
private final static int REQUIRE_ONCE = 534;
private final static int UNSET = 535;
private final static int FOREACH = 536;
private final static int AS = 537;
private final static int TEXT = 538;
private final static int ISSET = 539;
private final static int SWITCH = 540;
private final static int CASE = 541;
private final static int DEFAULT = 542;
private final static int EXIT = 543;
private final static int GLOBAL = 544;
private final static int ELSEIF = 545;
private final static int PRINT = 546;
private final static int SYSTEM_STRING = 547;
private final static int SIMPLE_SYSTEM_STRING = 548;
private final static int COMPLEX_SYSTEM_STRING = 549;
private final static int TEXT_ECHO = 550;
private final static int ENDIF = 551;
private final static int ENDWHILE = 552;
private final static int ENDFOR = 553;
private final static int ENDFOREACH = 554;
private final static int ENDSWITCH = 555;
private final static int XOR_RES = 556;
private final static int AND_RES = 557;
private final static int OR_RES = 558;
private final static int LIST = 559;
private final static int THIS = 560;
private final static int TRUE = 561;
private final static int FALSE = 562;
private final static int CLONE = 563;
private final static int INSTANCEOF = 564;
private final static int CONST = 565;
private final static int ABSTRACT = 566;
private final static int FINAL = 567;
private final static int DIE = 568;
private final static int THROW = 569;
private final static int TRY = 570;
private final static int CATCH = 571;
private final static int INTERFACE = 572;
private final static int IMPLEMENTS = 573;
private final static int LAST_IDENTIFIER_LEXEME = 1024;
private final static IntMap _insensitiveReserved = new IntMap();
private final static IntMap _reserved = new IntMap();
private Quercus _quercus;
private Path _sourceFile;
private ParserLocation _parserLocation = new ParserLocation();
private boolean _hasCr;
private int _peek = -1;
private Reader _is;
private CharBuffer _sb = new CharBuffer();
private int _peekToken = -1;
private String _lexeme = "";
private String _heredocEnd = null;
private GlobalScope _globalScope = new GlobalScope();
private boolean _returnsReference = false;
private Scope _scope = _globalScope;
private InterpretedClassDef _quercusClass;
private FunctionInfo _function;
private boolean _isTop;
QuercusParser(Quercus quercus)
{
_quercus = quercus;
}
public QuercusParser(Quercus quercus, Path sourceFile, Reader is)
{
_quercus = quercus;
init(sourceFile, is);
}
private void init(Path sourceFile)
throws IOException
{
init(sourceFile, sourceFile.openRead().getReader());
}
private void init(Path sourceFile, Reader is)
{
_sourceFile = sourceFile;
_is = is;
if (sourceFile != null)
_parserLocation.setFileName(sourceFile.getPath());
else
_parserLocation.setFileName("eval:");
_parserLocation.setLineNumber(1);
_peek = -1;
_peekToken = -1;
}
public void setLocation(String fileName, int line)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
resin-3.0.28 (2000个子文件)
config.c 36KB
stream.c 32KB
mod_caucho.c 32KB
mod_caucho.c 29KB
jni_os.c 7KB
jni_jvmti.c 4KB
jni_jvmdi.c 4KB
memory.c 3KB
protocol.cpp 24KB
iis.cpp 17KB
run.cpp 15KB
paths.cpp 12KB
isapi_srun.cpp 12KB
setup.cpp 8KB
service.cpp 7KB
apache.cpp 6KB
nsapi.cpp 5KB
website.cpp 4KB
service.cpp 3KB
httpd.cpp 2KB
configure.cpp 2KB
default.css 2KB
portal.css 897B
default.css 746B
default.css 88B
cse.h 11KB
iis.h 3KB
common.h 2KB
setup.h 2KB
resource.h 1KB
isapi_srun.h 1KB
version.h 1KB
resource.h 707B
resource.h 440B
package.html 8KB
package.html 6KB
package.html 5KB
package.html 4KB
package.html 4KB
package.html 4KB
package.html 3KB
package.html 2KB
package.html 2KB
package.html 2KB
package.html 2KB
package.html 2KB
package.html 1KB
json.html 1KB
index.html 1KB
package.html 1KB
package.html 946B
package.html 546B
package.html 75B
package.html 74B
package.html 61B
package.html 48B
QuercusParser.java 94KB
ArrayModule.java 94KB
StringModule.java 93KB
JavaGenerator.java 91KB
Env.java 83KB
PostgresModule.java 78KB
EntityIntrospector.java 76KB
ConnectionContext.java 73KB
XmlParser.java 73KB
Generator.java 66KB
OracleModule.java 65KB
FileModule.java 59KB
Application.java 59KB
AbstractHttpRequest.java 54KB
Hessian2Input.java 52KB
JspParser.java 51KB
AbstractHttpResponse.java 50KB
EjbEntityBean.java 48KB
EjbBean.java 48KB
ImageModule.java 47KB
JavaJspGenerator.java 45KB
Parser.java 45KB
PageContextImpl.java 42KB
Wrapper.java 41KB
Parser.java 41KB
QLParser.java 41KB
WebDavServlet.java 40KB
RegexpModule.java 40KB
CallableStatementWrapper.java 39KB
JspNode.java 38KB
RunnerRequest.java 38KB
XmlPrinter.java 38KB
DynamicClassLoader.java 38KB
XslParser.java 37KB
EntityComponent.java 37KB
SessionManager.java 37KB
HmuxRequest.java 36KB
BurlapInput.java 36KB
EntityType.java 36KB
JdbcResultResource.java 36KB
Lexer.java 35KB
IiopReader.java 35KB
PDFModule.java 35KB
XPathParser.java 35KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
josonchen
- 粉丝: 43
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页