From 20052ff75c224699725da0f8e096053009c62741 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 2 Dec 2015 00:58:31 -0800 Subject: [PATCH] The grammar and lexer should not share a filename. --- .gitignore | 12 +++--- Bridge.cpp | 1 + Console.cpp | 2 +- Decode.hpp | 2 +- Display.cpp | 4 +- Driver.cpp | 2 +- E4X/Syntax.hpp | 2 +- Error.hpp | 2 +- Execute.cpp | 28 ++++++------- Handler.cpp | 6 +-- Library.cpp | 16 ++++---- Makefile.am | 36 ++++++++--------- Makefile.in | 73 ++++++++++++---------------------- ObjectiveC/Internal.hpp | 3 +- ObjectiveC/Library.mm | 25 ++++++------ ObjectiveC/Output.cpp | 5 ++- ObjectiveC/Replace.cpp | 5 ++- ObjectiveC/Syntax.hpp | 2 +- Output.cpp | 3 +- Cycript.yy.in => Parser.ypp.in | 0 Replace.cpp | 6 +-- Replace.hpp | 2 +- Cycript.l.in => Scanner.lpp.in | 2 +- Server.cpp | 8 ++-- String.hpp | 4 +- Parser.cpp => Syntax.cpp | 2 +- Parser.hpp => Syntax.hpp | 12 +++--- backtrack.sh | 4 +- cycript.hpp | 3 +- 29 files changed, 127 insertions(+), 145 deletions(-) rename Cycript.yy.in => Parser.ypp.in (100%) rename Cycript.l.in => Scanner.lpp.in (99%) rename Parser.cpp => Syntax.cpp (98%) rename Parser.hpp => Syntax.hpp (99%) diff --git a/.gitignore b/.gitignore index 6d37fe1..8433dae 100644 --- a/.gitignore +++ b/.gitignore @@ -15,15 +15,17 @@ control.tmp config.log config.status Makefile -Cycript.yy -Cycript.l -Cycript.tab.* -Cycript.output +Parser.ypp +Parser.cpp +Parser.hpp +Parser.output +Scanner.lpp +Scanner.cpp +Scanner.output Bridge.gperf stack.hh sysroot.ios sysroot.sim -lex.cy.cpp lex.backup /cycript Bridge.hpp diff --git a/Bridge.cpp b/Bridge.cpp index 096de79..f3d1b6c 100644 --- a/Bridge.cpp +++ b/Bridge.cpp @@ -20,6 +20,7 @@ /* }}} */ #include + #include "Bridge.hpp" extern "C" struct CYBridgeEntry *CYBridgeHash(const char *data, size_t size) { diff --git a/Console.cpp b/Console.cpp index 57f4375..e2cf364 100644 --- a/Console.cpp +++ b/Console.cpp @@ -69,7 +69,7 @@ #include "Display.hpp" #include "Driver.hpp" #include "Highlight.hpp" -#include "Parser.hpp" +#include "Syntax.hpp" static volatile enum { Working, diff --git a/Decode.hpp b/Decode.hpp index f84cf00..be4e8b9 100644 --- a/Decode.hpp +++ b/Decode.hpp @@ -24,7 +24,7 @@ #include -#include "Parser.hpp" +#include "Syntax.hpp" CYTypedIdentifier *Decode(CYPool &pool, struct sig::Type *type); diff --git a/Display.cpp b/Display.cpp index ed643f2..5227fa1 100644 --- a/Display.cpp +++ b/Display.cpp @@ -32,10 +32,10 @@ #include -#include "Highlight.hpp" - #include +#include "Highlight.hpp" + typedef std::complex CYCursor; extern "C" int rl_display_fixed; diff --git a/Driver.cpp b/Driver.cpp index 4bac2c2..df31a03 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -20,7 +20,7 @@ /* }}} */ #include "Driver.hpp" -#include "Parser.hpp" +#include "Syntax.hpp" bool CYParser(CYPool &pool, bool debug); diff --git a/E4X/Syntax.hpp b/E4X/Syntax.hpp index 1789ead..4828cdc 100644 --- a/E4X/Syntax.hpp +++ b/E4X/Syntax.hpp @@ -22,7 +22,7 @@ #ifndef CYCRIPT_E4X_SYNTAX_HPP #define CYCRIPT_E4X_SYNTAX_HPP -#include "Parser.hpp" +#include "Syntax.hpp" struct CYDefaultXMLNamespace : CYStatement diff --git a/Error.hpp b/Error.hpp index 4d899e0..f63180e 100644 --- a/Error.hpp +++ b/Error.hpp @@ -22,8 +22,8 @@ #ifndef CYCRIPT_ERROR_HPP #define CYCRIPT_ERROR_HPP -#include "Pooling.hpp" #include "Exception.hpp" +#include "Pooling.hpp" #ifdef CY_EXECUTE struct CYJSError : diff --git a/Execute.cpp b/Execute.cpp index 89a796a..80b9e63 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -19,35 +19,33 @@ **/ /* }}} */ -#include "Internal.hpp" +#include "cycript.hpp" + +#include +#include +#include +#include +#include +#include #include #include #include #include -#include "cycript.hpp" - -#include "sig/parse.hpp" -#include "sig/ffi_type.hpp" - -#include "Pooling.hpp" -#include "Execute.hpp" - #include #include -#include -#include -#include -#include -#include -#include +#include "sig/parse.hpp" +#include "sig/ffi_type.hpp" #include "Code.hpp" #include "Decode.hpp" #include "Error.hpp" +#include "Execute.hpp" +#include "Internal.hpp" #include "JavaScript.hpp" +#include "Pooling.hpp" #include "String.hpp" static std::vector &GetHooks() { diff --git a/Handler.cpp b/Handler.cpp index 2a17d61..a49fcb6 100644 --- a/Handler.cpp +++ b/Handler.cpp @@ -19,6 +19,8 @@ **/ /* }}} */ +#include "cycript.hpp" + #include #include #include @@ -34,11 +36,9 @@ #include #endif -#include "cycript.hpp" - #include "Driver.hpp" #include "JavaScript.hpp" -#include "Parser.hpp" +#include "Syntax.hpp" #include "Pooling.hpp" struct CYExecute_ { diff --git a/Library.cpp b/Library.cpp index e8e70d6..f5eb1c3 100644 --- a/Library.cpp +++ b/Library.cpp @@ -19,14 +19,8 @@ **/ /* }}} */ -#include - #include "cycript.hpp" -#include "Pooling.hpp" - -#include - #include #include #include @@ -34,13 +28,17 @@ #include #include +#include + +#include + +#include "ConvertUTF.h" #include "Driver.hpp" #include "Error.hpp" #include "Execute.hpp" -#include "Parser.hpp" +#include "Pooling.hpp" #include "String.hpp" - -#include "ConvertUTF.h" +#include "Syntax.hpp" template <> ::pthread_key_t CYLocal::key_ = Key_(); diff --git a/Makefile.am b/Makefile.am index d89c83f..343b050 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,8 +43,8 @@ lib_LTLIBRARIES += libcycript.la libcycript_la_LDFLAGS = $(CY_LDFLAGS) libcycript_la_LIBADD = $(LTLIBFFI) $(LTLIBGCC) -ldl -libcycript_la_SOURCES = ConvertUTF.c Decode.cpp Driver.cpp Highlight.cpp Library.cpp Network.cpp Output.cpp Parser.cpp Replace.cpp -libcycript_la_SOURCES += Cycript.tab.cc lex.cy.cpp +libcycript_la_SOURCES = ConvertUTF.c Decode.cpp Driver.cpp Highlight.cpp Library.cpp Network.cpp Output.cpp Replace.cpp Syntax.cpp +libcycript_la_SOURCES += Parser.cpp Scanner.cpp filters = @@ -95,25 +95,25 @@ AM_CPPFLAGS += -DCY_ATTACH endif endif -CLEANFILES += Cycript.yy -Cycript.yy: Cycript.yy.in +CLEANFILES += Parser.ypp +Parser.ypp: Parser.ypp.in $(srcdir)/Filter.sh $< >$@ $(filters) -CLEANFILES += Cycript.l -Cycript.l: Cycript.l.in UnicodeIDStart.l UnicodeIDContinue.l +CLEANFILES += Scanner.lpp +Scanner.lpp: Scanner.lpp.in UnicodeIDStart.l UnicodeIDContinue.l $(srcdir)/Filter.sh $< >$@ $(filters) -CLEANFILES += lex.cy.cpp -lex.cy.cpp: Cycript.l - $(FLEX) -o $@ -T $< 2>lex.output || (grep -F '$<:' lex.output; false) - grep -F 'No backing up.' lex.backup >/dev/null - ! grep -F ': warning, ' lex.output || true +CLEANFILES += Scanner.cpp Scanner.output lex.backup +Scanner.cpp: Scanner.lpp + $(FLEX) -o $@ -T $< 2>Scanner.output || (grep -F '$<:' Scanner.output; false) + grep -E '^(No backing up\.|Compressed tables always back up\.)$$' lex.backup >/dev/null + ! grep -F ': warning, ' Scanner.output || true -lex.cy.lo: Cycript.tab.hh +Scanner.lo: Parser.hpp -CLEANFILES += Cycript.tab.cc Cycript.tab.hh stack.hh Cycript.output -Cycript.tab.cc Cycript.tab.hh stack.hh Cycript.output: Cycript.yy - $(BISON) -v --report=state -Werror $< - ! grep -n '^State [0-9]* conflicts:' Cycript.output - ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Cycript.output -B 2 | grep 'shift, and go to state [0-9]*$$' - ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Cycript.output -B 2 | grep -v '$$default' | grep 'reduce using rule [0-9]* ([^)]*)$$' +CLEANFILES += Parser.cpp Parser.hpp stack.hh Parser.output +Parser.cpp Parser.hpp stack.hh Parser.output: Parser.ypp + $(BISON) -v --report=state -Werror -o Parser.cpp $< + ! grep -n '^State [0-9]* conflicts:' Parser.output + ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep 'shift, and go to state [0-9]*$$' + ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep -v '$$default' | grep 'reduce using rule [0-9]* ([^)]*)$$' diff --git a/Makefile.in b/Makefile.in index ba8d8f5..9d6be43 100644 --- a/Makefile.in +++ b/Makefile.in @@ -180,8 +180,8 @@ libcycript_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) am__libcycript_la_SOURCES_DIST = ConvertUTF.c Decode.cpp Driver.cpp \ - Highlight.cpp Library.cpp Network.cpp Output.cpp Parser.cpp \ - Replace.cpp Cycript.tab.cc lex.cy.cpp Complete.cpp \ + Highlight.cpp Library.cpp Network.cpp Output.cpp Replace.cpp \ + Syntax.cpp Parser.cpp Scanner.cpp Complete.cpp \ sig/ffi_type.cpp sig/parse.cpp sig/copy.cpp Bridge.cpp \ Execute.cpp JavaScriptCore.cpp Java/Execute.cpp \ ObjectiveC/Output.cpp ObjectiveC/Replace.cpp \ @@ -197,8 +197,8 @@ am__dirstamp = $(am__leading_dot)dirstamp @CY_OBJECTIVEC_TRUE@ ObjectiveC/Library.lo @CY_ATTACH_TRUE@am__objects_5 = Handler.lo am_libcycript_la_OBJECTS = ConvertUTF.lo Decode.lo Driver.lo \ - Highlight.lo Library.lo Network.lo Output.lo Parser.lo \ - Replace.lo Cycript.tab.lo lex.cy.lo $(am__objects_1) \ + Highlight.lo Library.lo Network.lo Output.lo Replace.lo \ + Syntax.lo Parser.lo Scanner.lo $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) libcycript_la_OBJECTS = $(am_libcycript_la_OBJECTS) @@ -536,8 +536,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = subdir-objects -CLEANFILES = $(am__append_6) Cycript.yy Cycript.l lex.cy.cpp \ - Cycript.tab.cc Cycript.tab.hh stack.hh Cycript.output +CLEANFILES = $(am__append_6) Parser.ypp Scanner.lpp Scanner.cpp \ + Scanner.output lex.backup Parser.cpp Parser.hpp stack.hh \ + Parser.output SUBDIRS = ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -DYYDEBUG=1 -include config.h -include \ @@ -552,8 +553,8 @@ libcycript_la_LDFLAGS = $(CY_LDFLAGS) libcycript_la_LIBADD = $(LTLIBFFI) $(LTLIBGCC) -ldl $(am__append_3) \ $(am__append_9) $(am__append_12) libcycript_la_SOURCES = ConvertUTF.c Decode.cpp Driver.cpp \ - Highlight.cpp Library.cpp Network.cpp Output.cpp Parser.cpp \ - Replace.cpp Cycript.tab.cc lex.cy.cpp $(am__append_1) \ + Highlight.cpp Library.cpp Network.cpp Output.cpp Replace.cpp \ + Syntax.cpp Parser.cpp Scanner.cpp $(am__append_1) \ $(am__append_2) $(am__append_8) $(am__append_11) \ $(am__append_13) filters = $(am__append_5) $(am__append_7) $(am__append_10) @@ -564,7 +565,7 @@ all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -.SUFFIXES: .c .cc .cpp .lo .mm .o .obj +.SUFFIXES: .c .cpp .lo .mm .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @@ -749,7 +750,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Complete.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Console.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConvertUTF.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cycript.tab.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Decode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Display.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Driver.Plo@am__quote@ @@ -763,7 +763,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Output.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Replace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lex.cy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Scanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Syntax.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@Java/$(DEPDIR)/Execute.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Library.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Output.Plo@am__quote@ @@ -796,30 +797,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cc.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @@ -1326,21 +1303,21 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES @CY_EXECUTE_TRUE@ $(srcdir)/Bridge.sh $< >$@ @CY_EXECUTE_TRUE@Bridge.hpp: Bridge.gperf @CY_EXECUTE_TRUE@ $(GPERF) $< >$@ -Cycript.yy: Cycript.yy.in +Parser.ypp: Parser.ypp.in $(srcdir)/Filter.sh $< >$@ $(filters) -Cycript.l: Cycript.l.in UnicodeIDStart.l UnicodeIDContinue.l +Scanner.lpp: Scanner.lpp.in UnicodeIDStart.l UnicodeIDContinue.l $(srcdir)/Filter.sh $< >$@ $(filters) -lex.cy.cpp: Cycript.l - $(FLEX) -o $@ -T $< 2>lex.output || (grep -F '$<:' lex.output; false) - grep -F 'No backing up.' lex.backup >/dev/null - ! grep -F ': warning, ' lex.output || true - -lex.cy.lo: Cycript.tab.hh -Cycript.tab.cc Cycript.tab.hh stack.hh Cycript.output: Cycript.yy - $(BISON) -v --report=state -Werror $< - ! grep -n '^State [0-9]* conflicts:' Cycript.output - ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Cycript.output -B 2 | grep 'shift, and go to state [0-9]*$$' - ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Cycript.output -B 2 | grep -v '$$default' | grep 'reduce using rule [0-9]* ([^)]*)$$' +Scanner.cpp: Scanner.lpp + $(FLEX) -o $@ -T $< 2>Scanner.output || (grep -F '$<:' Scanner.output; false) + grep -E '^(No backing up\.|Compressed tables always back up\.)$$' lex.backup >/dev/null + ! grep -F ': warning, ' Scanner.output || true + +Scanner.lo: Parser.hpp +Parser.cpp Parser.hpp stack.hh Parser.output: Parser.ypp + $(BISON) -v --report=state -Werror -o Parser.cpp $< + ! grep -n '^State [0-9]* conflicts:' Parser.output + ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep 'shift, and go to state [0-9]*$$' + ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep -v '$$default' | grep 'reduce using rule [0-9]* ([^)]*)$$' # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/ObjectiveC/Internal.hpp b/ObjectiveC/Internal.hpp index d4e5426..9cffb48 100644 --- a/ObjectiveC/Internal.hpp +++ b/ObjectiveC/Internal.hpp @@ -22,9 +22,10 @@ #ifndef CYCRIPT_OBJECTIVEC_INTERNAL_HPP #define CYCRIPT_OBJECTIVEC_INTERNAL_HPP -#include #include +#include "../Internal.hpp" + struct Selector_privateData : CYValue { diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 87ad547..86c705f 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -21,22 +21,27 @@ #include "cycript.hpp" -#include "ObjectiveC/Internal.hpp" +#include + +#include +#include + +#include + +#ifdef __APPLE__ +#include +#include +#endif #include #include -#include - #ifdef __APPLE__ #include #include #endif -#ifdef __APPLE__ -#include -#include -#endif +#include #include "Code.hpp" #include "Error.hpp" @@ -44,11 +49,7 @@ #include "String.hpp" #include "Execute.hpp" -#include -#include -#include - -#include +#include "ObjectiveC/Internal.hpp" #define CYObjectiveTry_ { \ try diff --git a/ObjectiveC/Output.cpp b/ObjectiveC/Output.cpp index 9d0caa0..360a54e 100644 --- a/ObjectiveC/Output.cpp +++ b/ObjectiveC/Output.cpp @@ -19,10 +19,11 @@ **/ /* }}} */ +#include + #include "Replace.hpp" -#include "ObjectiveC/Syntax.hpp" -#include +#include "ObjectiveC/Syntax.hpp" void CYCategory::Output(CYOutput &out, CYFlags flags) const { out << "(function($cys,$cyp,$cyc,$cyn,$cyt){"; diff --git a/ObjectiveC/Replace.cpp b/ObjectiveC/Replace.cpp index 1b71e02..74e9227 100644 --- a/ObjectiveC/Replace.cpp +++ b/ObjectiveC/Replace.cpp @@ -19,10 +19,11 @@ **/ /* }}} */ +#include + #include "Replace.hpp" -#include "ObjectiveC/Syntax.hpp" -#include +#include "ObjectiveC/Syntax.hpp" static CYExpression *MessageType(CYContext &context, CYTypedIdentifier *type, CYMessageParameter *next, CYExpression *extra = NULL) { CYExpression *left($C0($M(type->Replace(context), $S("toString")))); diff --git a/ObjectiveC/Syntax.hpp b/ObjectiveC/Syntax.hpp index d7a74cd..025612a 100644 --- a/ObjectiveC/Syntax.hpp +++ b/ObjectiveC/Syntax.hpp @@ -22,7 +22,7 @@ #ifndef CYCRIPT_OBJECTIVEC_SYNTAX_HPP #define CYCRIPT_OBJECTIVEC_SYNTAX_HPP -#include "Parser.hpp" +#include "../Syntax.hpp" struct CYInstanceLiteral : CYExpression diff --git a/Output.cpp b/Output.cpp index 2ff5ad7..c8205e5 100644 --- a/Output.cpp +++ b/Output.cpp @@ -20,10 +20,11 @@ /* }}} */ #include "cycript.hpp" -#include "Parser.hpp" #include +#include "Syntax.hpp" + void CYOutput::Terminate() { operator ()(';'); mode_ = NoMode; diff --git a/Cycript.yy.in b/Parser.ypp.in similarity index 100% rename from Cycript.yy.in rename to Parser.ypp.in diff --git a/Replace.cpp b/Replace.cpp index 06b6359..bc162d3 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -19,11 +19,11 @@ **/ /* }}} */ -#include "Parser.hpp" -#include "Replace.hpp" - #include +#include "Replace.hpp" +#include "Syntax.hpp" + CYFunctionExpression *CYNonLocalize(CYContext &context, CYFunctionExpression *function) { function->nonlocal_ = context.nextlocal_; return function; diff --git a/Replace.hpp b/Replace.hpp index 4aa6e00..3fac91e 100644 --- a/Replace.hpp +++ b/Replace.hpp @@ -22,7 +22,7 @@ #ifndef CYCRIPT_REPLACE_HPP #define CYCRIPT_REPLACE_HPP -#include "Parser.hpp" +#include "Syntax.hpp" #define $ new($pool) diff --git a/Cycript.l.in b/Scanner.lpp.in similarity index 99% rename from Cycript.l.in rename to Scanner.lpp.in index 114b19a..bcbd0d0 100644 --- a/Cycript.l.in +++ b/Scanner.lpp.in @@ -36,7 +36,7 @@ %{ #define YYLTYPE CYLocation -#include "Cycript.tab.hh" +#include "Parser.hpp" typedef cy::parser::token tk; #include "Highlight.hpp" diff --git a/Server.cpp b/Server.cpp index e6415f0..e3f61fc 100644 --- a/Server.cpp +++ b/Server.cpp @@ -19,16 +19,16 @@ **/ /* }}} */ -#include - #include #include -#include -#include #include +#include +#include #include +#include "Pooling.hpp" + struct Client { CFHTTPMessageRef message_; CFSocketRef socket_; diff --git a/String.hpp b/String.hpp index ce48f2c..2f52007 100644 --- a/String.hpp +++ b/String.hpp @@ -22,10 +22,10 @@ #ifndef CYCRIPT_STRING_HPP #define CYCRIPT_STRING_HPP -#include "Pooling.hpp" - #include +#include "Pooling.hpp" + struct CYUTF8String { const char *data; size_t size; diff --git a/Parser.cpp b/Syntax.cpp similarity index 98% rename from Parser.cpp rename to Syntax.cpp index f9a146a..c2e84e8 100644 --- a/Parser.cpp +++ b/Syntax.cpp @@ -19,7 +19,7 @@ **/ /* }}} */ -#include "Parser.hpp" +#include "Syntax.hpp" CYRange DigitRange_ (0x3ff000000000000LLU, 0x000000000000000LLU); // 0-9 CYRange WordStartRange_(0x000001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$ diff --git a/Parser.hpp b/Syntax.hpp similarity index 99% rename from Parser.hpp rename to Syntax.hpp index 02b08eb..3d248d6 100644 --- a/Parser.hpp +++ b/Syntax.hpp @@ -19,8 +19,11 @@ **/ /* }}} */ -#ifndef CYCRIPT_PARSER_HPP -#define CYCRIPT_PARSER_HPP +#ifndef CYCRIPT_SYNTAX_HPP +#define CYCRIPT_SYNTAX_HPP + +#include +#include #include #include @@ -28,13 +31,10 @@ #include #include -#include -#include - #include "List.hpp" #include "Location.hpp" -#include "Pooling.hpp" #include "Options.hpp" +#include "Pooling.hpp" struct CYContext; diff --git a/backtrack.sh b/backtrack.sh index 20b250f..6ad3f07 100755 --- a/backtrack.sh +++ b/backtrack.sh @@ -1,5 +1,5 @@ #!/bin/bash ./apple-make.sh build-osx-i386 echo "backup $(grep -c '^State ' build.osx-i386/lex.backup)" -echo "states $(grep '^static .* yy_accept\[' build.osx-i386/lex.cy.cpp | sed -e 's/.*\[//;s/].*//') 3528" -echo "jammed $(grep -F 'accepts: ['"$(grep 'jammed' build.osx-i386/lex.cy.cpp -B 3 | head -n 1 | sed -e 's/:$//;s/.* //')"']' build.osx-i386/lex.output | sed -e 's/.* # //;s/ .*//')" +echo "states $(grep '^static .* yy_accept\[' build.osx-i386/Scanner.cpp | sed -e 's/.*\[//;s/].*//') 3528" +echo "jammed $(grep -F 'accepts: ['"$(grep 'jammed' build.osx-i386/Scanner.cpp -B 3 | head -n 1 | sed -e 's/:$//;s/.* //')"']' build.osx-i386/Scanner.output | sed -e 's/.* # //;s/ .*//')" diff --git a/cycript.hpp b/cycript.hpp index 0f6ed13..a70cd94 100644 --- a/cycript.hpp +++ b/cycript.hpp @@ -22,9 +22,10 @@ #ifndef CYCRIPT_HPP #define CYCRIPT_HPP -#include #include +#include + #include "Pooling.hpp" #include "String.hpp" -- 2.47.2