Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13969193
D13978.id33718.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D13978.id33718.diff
View Options
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@
/support/xhpast/parser.yacc.output
/support/xhpast/node_names.hpp
/support/xhpast/xhpast
+/support/xhpast/xhpast.exe
/src/parser/xhpast/bin/xhpast
## NOTE: Don't .gitignore these files! Even though they're build artifacts, we
@@ -23,9 +24,6 @@
# This is an OS X build artifact.
/support/xhpast/xhpast.dSYM
-# This is a Windows build artifact.
-/support/xhpast/xhpast.exe
-
# libphutil
/src/.phutil_module_cache
/support/phutiltestlib/.phutil_module_cache
diff --git a/support/xhpast/Makefile b/support/xhpast/Makefile
--- a/support/xhpast/Makefile
+++ b/support/xhpast/Makefile
@@ -1,4 +1,4 @@
-BISONFLAGS = --verbose -d -Wall
+BISONFLAGS = --verbose -Wall
CPPFLAGS = -fPIC
FLEXFLAGS = -C
@@ -24,47 +24,45 @@
ROOT = ../../src/parser/xhpast
+.PHONY: all
all: xhpast
clean:
- -rm xhpast parser.yacc.output libxhpast.a *.o 2>/dev/null
+ rm --force xhpast parser.yacc.output libxhpast.a *.o
cleanall: clean
- -rm scanner.lex.cpp scanner.lex.hpp parser.yacc.cpp parser.yacc.hpp
+ rm --force scanner.lex.hpp scanner.lex.cpp parser.yacc.hpp parser.yacc.cpp
+ rm --force node_names.hpp parser_nodes.php
+.PHONY: install
install: xhpast
cp xhpast $(ROOT)/bin/xhpast
-scanner: scanner.l
- flex $(FLEXFLAGS) --header-file=scanner.lex.hpp --outfile=scanner.lex.cpp $<
- echo '/* @gen''er''ated */' >> scanner.lex.cpp
- echo '/* @gen''er''ated */' >> scanner.lex.hpp
+.PHONY: parser scanner
+parser: parser.yacc.hpp parser.yacc.cpp
+scanner: scanner.lex.hpp scanner.lex.cpp
-parser: parser.y
- bison $(BISONFLAGS) --output=parser.yacc.cpp $<
- echo '/* @gen''er''ated */' >> parser.yacc.cpp
- echo '/* @gen''er''ated */' >> parser.yacc.hpp
+%.lex.hpp %.lex.cpp: %.l
+ flex $(FLEXFLAGS) --header-file=$*.lex.hpp --outfile=$*.lex.cpp $<
+ @echo '/* @gen''er''ated */' >> $*.lex.hpp
+ @echo '/* @gen''er''ated */' >> $*.lex.cpp
-node_names.hpp: generate_nodes.php
- php -f generate_nodes.php
- cp parser_nodes.php $(ROOT)/
+%.yacc.hpp %.yacc.cpp: %.y
+ bison $(BISONFLAGS) --defines=$*.yacc.hpp --output=$*.yacc.cpp $<
+ @echo '/* @gen''er''ated */' >> $*.yacc.hpp
+ @echo '/* @gen''er''ated */' >> $*.yacc.cpp
%.o: %.cpp
$(CXX) -c $(CPPFLAGS) -o $@ $<
-needparserscanner:
- @([ -e parser.yacc.hpp ] && [ -e parser.yacc.cpp ] && \
- [ -e scanner.lex.hpp ] && [ -e scanner.lex.cpp ]) \
- || (echo "Run 'make parser scanner' first.'" && exit 1)
+node_names.hpp parser_nodes.php: generate_nodes.php
+ php -f $<
-parser.yacc.o: needparserscanner scanner.lex.hpp
-
-scanner.lex.o: needparserscanner parser.yacc.hpp node_names.hpp scanner.lex.hpp
+parser.yacc.o: scanner.lex.hpp
+scanner.lex.o: parser.yacc.hpp node_names.hpp scanner.lex.hpp
libxhpast.a: astnode.o scanner.lex.o parser.yacc.o
$(AR) -crs $@ $^
xhpast: xhpast.cpp libxhpast.a
$(CXX) $(CPPFLAGS) -o $@ $^
-
-.PHONY: all clean
diff --git a/support/xhpast/generate_nodes.php b/support/xhpast/generate_nodes.php
--- a/support/xhpast/generate_nodes.php
+++ b/support/xhpast/generate_nodes.php
@@ -142,5 +142,5 @@
}
$php .= " );\n";
$php .= "}\n";
-file_put_contents('parser_nodes.php', $php);
+file_put_contents('../../src/parser/xhpast/parser_nodes.php', $php);
echo "Wrote PHP definition.\n";
diff --git a/support/xhpast/parser_nodes.php b/support/xhpast/parser_nodes.php
deleted file mode 100644
--- a/support/xhpast/parser_nodes.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/* @generated @undivinable */
-
-function xhp_parser_node_constants() {
- return array(
- 9000 => 'n_PROGRAM',
- 9001 => 'n_SYMBOL_NAME',
- 9002 => 'n_HALT_COMPILER',
- 9003 => 'n_NAMESPACE',
- 9004 => 'n_STATEMENT',
- 9005 => 'n_EMPTY',
- 9006 => 'n_STATEMENT_LIST',
- 9007 => 'n_OPEN_TAG',
- 9008 => 'n_CLOSE_TAG',
- 9009 => 'n_USE_LIST',
- 9010 => 'n_USE',
- 9011 => 'n_CONSTANT_DECLARATION_LIST',
- 9012 => 'n_CONSTANT_DECLARATION',
- 9013 => 'n_STRING',
- 9014 => 'n_LABEL',
- 9015 => 'n_CONDITION_LIST',
- 9016 => 'n_CONTROL_CONDITION',
- 9017 => 'n_IF',
- 9018 => 'n_ELSEIF',
- 9019 => 'n_ELSE',
- 9020 => 'n_WHILE',
- 9021 => 'n_DO_WHILE',
- 9022 => 'n_FOR',
- 9023 => 'n_FOR_EXPRESSION',
- 9024 => 'n_SWITCH',
- 9025 => 'n_BREAK',
- 9026 => 'n_CONTINUE',
- 9027 => 'n_RETURN',
- 9028 => 'n_GLOBAL_DECLARATION_LIST',
- 9029 => 'n_GLOBAL_DECLARATION',
- 9030 => 'n_STATIC_DECLARATION_LIST',
- 9031 => 'n_STATIC_DECLARATION',
- 9032 => 'n_ECHO_LIST',
- 9033 => 'n_ECHO',
- 9034 => 'n_INLINE_HTML',
- 9035 => 'n_UNSET_LIST',
- 9036 => 'n_UNSET',
- 9037 => 'n_FOREACH',
- 9038 => 'n_FOREACH_EXPRESSION',
- 9039 => 'n_THROW',
- 9040 => 'n_GOTO',
- 9041 => 'n_TRY',
- 9042 => 'n_CATCH_LIST',
- 9043 => 'n_CATCH',
- 9044 => 'n_DECLARE',
- 9045 => 'n_DECLARE_DECLARATION_LIST',
- 9046 => 'n_DECLARE_DECLARATION',
- 9047 => 'n_VARIABLE',
- 9048 => 'n_REFERENCE',
- 9049 => 'n_VARIABLE_REFERENCE',
- 9050 => 'n_FUNCTION_DECLARATION',
- 9051 => 'n_CLASS_DECLARATION',
- 9052 => 'n_CLASS_ATTRIBUTES',
- 9053 => 'n_EXTENDS',
- 9054 => 'n_EXTENDS_LIST',
- 9055 => 'n_IMPLEMENTS_LIST',
- 9056 => 'n_INTERFACE_DECLARATION',
- 9057 => 'n_CASE',
- 9058 => 'n_DEFAULT',
- 9059 => 'n_DECLARATION_PARAMETER_LIST',
- 9060 => 'n_DECLARATION_PARAMETER',
- 9061 => 'n_TYPE_NAME',
- 9062 => 'n_VARIABLE_VARIABLE',
- 9063 => 'n_CLASS_MEMBER_DECLARATION_LIST',
- 9064 => 'n_CLASS_MEMBER_DECLARATION',
- 9065 => 'n_CLASS_CONSTANT_DECLARATION_LIST',
- 9066 => 'n_CLASS_CONSTANT_DECLARATION',
- 9067 => 'n_METHOD_DECLARATION',
- 9068 => 'n_METHOD_MODIFIER_LIST',
- 9069 => 'n_FUNCTION_MODIFIER_LIST',
- 9070 => 'n_CLASS_MEMBER_MODIFIER_LIST',
- 9071 => 'n_EXPRESSION_LIST',
- 9072 => 'n_LIST',
- 9073 => 'n_ASSIGNMENT',
- 9074 => 'n_NEW',
- 9075 => 'n_UNARY_PREFIX_EXPRESSION',
- 9076 => 'n_UNARY_POSTFIX_EXPRESSION',
- 9077 => 'n_BINARY_EXPRESSION',
- 9078 => 'n_TERNARY_EXPRESSION',
- 9079 => 'n_CAST_EXPRESSION',
- 9080 => 'n_CAST',
- 9081 => 'n_OPERATOR',
- 9082 => 'n_ARRAY_LITERAL',
- 9083 => 'n_EXIT_EXPRESSION',
- 9084 => 'n_BACKTICKS_EXPRESSION',
- 9085 => 'n_LEXICAL_VARIABLE_LIST',
- 9086 => 'n_NUMERIC_SCALAR',
- 9087 => 'n_STRING_SCALAR',
- 9088 => 'n_MAGIC_SCALAR',
- 9089 => 'n_CLASS_STATIC_ACCESS',
- 9090 => 'n_CLASS_NAME',
- 9091 => 'n_MAGIC_CLASS_KEYWORD',
- 9092 => 'n_OBJECT_PROPERTY_ACCESS',
- 9093 => 'n_ARRAY_VALUE_LIST',
- 9094 => 'n_ARRAY_VALUE',
- 9095 => 'n_CALL_PARAMETER_LIST',
- 9096 => 'n_VARIABLE_EXPRESSION',
- 9097 => 'n_INCLUDE_FILE',
- 9098 => 'n_HEREDOC',
- 9099 => 'n_FUNCTION_CALL',
- 9100 => 'n_INDEX_ACCESS',
- 9101 => 'n_ASSIGNMENT_LIST',
- 9102 => 'n_METHOD_CALL',
- 9103 => 'n_CONCATENATION_LIST',
- 9104 => 'n_PARENTHETICAL_EXPRESSION',
- 9105 => 'n_TRAIT_USE',
- 9106 => 'n_TRAIT_USE_LIST',
- 9107 => 'n_TRAIT_ADAPTATION_LIST',
- 9108 => 'n_TRAIT_INSTEADOF',
- 9109 => 'n_TRAIT_REFERENCE_LIST',
- 9110 => 'n_TRAIT_METHOD_REFERENCE',
- 9111 => 'n_TRAIT_AS',
- 9112 => 'n_YIELD',
- 9113 => 'n_FINALLY',
- );
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 18, 1:04 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6724233
Default Alt Text
D13978.id33718.diff (7 KB)
Attached To
Mode
D13978: Improvements to makefile
Attached
Detach File
Event Timeline
Log In to Comment