From 427714df448d19d4a06f44d80f08e99826994483 Mon Sep 17 00:00:00 2001 From: vadim Date: Wed, 22 Nov 2017 12:06:56 +0200 Subject: [PATCH] remove unused files --- Makefile | 4 +- example.l | 237 -------------------------------------- php-parser.go => lexer.go | 0 php-parser.l => lexer.l | 0 strings | 15 --- 5 files changed, 2 insertions(+), 254 deletions(-) delete mode 100644 example.l rename php-parser.go => lexer.go (100%) rename php-parser.l => lexer.l (100%) delete mode 100644 strings diff --git a/Makefile b/Makefile index 7d43b18..a1348ad 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,13 @@ # blame: jnml, labs.nic.cz -all: php-parser.go +all: lexer.go go build run: all ./php-parser -php-parser.go: php-parser.l +lexer.go: lexer.l golex -t $< | gofmt > $@ clean: diff --git a/example.l b/example.l deleted file mode 100644 index 193ebfa..0000000 --- a/example.l +++ /dev/null @@ -1,237 +0,0 @@ -%{ -// Copyright (c) 2011 CZ.NIC z.s.p.o. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// blame: jnml, labs.nic.cz - -package main - -import ( - "bufio" - "fmt" - "os" - "bytes" -) - -var ( - src = bufio.NewReader(os.Stdin) - buf []byte - current byte - isPhp bool - sc int -) - -const ( - INITIAL = iota - PHP -) - -func skipHtml() { - for !isPhp{ - t_open_tag := []byte("\0 return -[ \t\n\r]+ -. -\<\?|\<\?php fmt.Println("T_OPEN_TAG");begin(PHP) -\<\?= fmt.Println("T_OPEN_TAG_WITH_ECHO");begin(PHP) - -. fmt.Printf("%q\n", buf) -[ \t\n\r]+ fmt.Println("T_WHITESPACE") - // \<\?|\<\?php fmt.Println("T_OPEN_TAG"); - // \<\?= fmt.Println("T_OPEN_TAG_WITH_ECHO"); -\?\> fmt.Println("T_CLOSE_TAG");begin(INITIAL) - // abstract fmt.Println("T_ABSTRACT") - // &= fmt.Println("T_AND_EQUAL") - // \(array\) fmt.Println("T_ARRAY_CAST") - // \(bool\)|\(boolean\) fmt.Println("T_BOOL_CAST") - // \(real\)|\(double\)|\(float\) fmt.Println("T_DOUBLE_CAST") - // \(int\)|\(integer\) fmt.Println("T_INT_CAST") - // \(object\) fmt.Println("T_OBJECT_CAST") - // \(string\) fmt.Println("T_STRING_CAST") - // \(unset\) fmt.Println("T_UNSET_CAST") - // array fmt.Println("T_ARRAY") - // as fmt.Println("T_AS") - // && fmt.Println("T_BOOLEAN_AND") - // \|\| fmt.Println("T_BOOLEAN_OR") - // break fmt.Println("T_BREAK") - // callable fmt.Println("T_CALLABLE") - // case fmt.Println("T_CASE") - // catch fmt.Println("T_CATCH") - // class fmt.Println("T_CLASS") - // __CLASS__ fmt.Println("T_CLASS_C") - // __DIR__ fmt.Println("T_DIR") - // clone fmt.Println("T_CLONE") - // [/][/][^\n]+ fmt.Println("T_COMMENT"); // TODO: multiline comment - // \.= fmt.Println("T_CONCAT_EQUAL"); - // [/]= fmt.Println("T_DIV_EQUAL"); - // const fmt.Println("T_CONST"); - // continue fmt.Println("T_CONTINUE"); - // -- fmt.Println("T_DEC"); - // declare fmt.Println("T_DECLARE"); - // default fmt.Println("T_DEFAULT"); - // do fmt.Println("T_DO"); - // {D}\.{D}?|\.{D} fmt.Println("T_DNUMBER"); - // => fmt.Println("T_DOUBLE_ARROW"); - // :: fmt.Println("T_DOUBLE_COLON"); - // echo fmt.Println("T_ECHO"); - // \.\.\. fmt.Println("T_ELLIPSIS"); - // else fmt.Println("T_ELSE"); - // elseif fmt.Println("T_ELSEIF"); - // empty fmt.Println("T_EMPTY"); - // endfor fmt.Println("T_ENDFOR") - // endforeach fmt.Println("T_ENDFOREACH") - // endif fmt.Println("T_ENDIF") - // endswitch fmt.Println("T_ENDSWITCH") - // endwhile fmt.Println("T_ENDWHILE") - // exit|die fmt.Println("T_EXIT") - // extends fmt.Println("T_EXTENDS") - // __FILE__ fmt.Println("T_FILE") - // final fmt.Println("T_FINAL") - // finally fmt.Println("T_FINALLY") - // for fmt.Println("T_FOR") - // foreach fmt.Println("T_FOREACH") - // function|cfunction fmt.Println("T_FUNCTION") - // __FUNCTION__ fmt.Println("T_FUNC_C") - // global fmt.Println("T_GLOBAL") - // goto fmt.Println("T_GOTO") - // if fmt.Println("T_IF") - // implements fmt.Println("T_IMPLEMENTS") - // \+\+ fmt.Println("T_INC") - // instanceof fmt.Println("T_INSTANCEOF") - // insteadof fmt.Println("T_INSTEADOF") - // interface fmt.Println("T_INTERFACE") - // == fmt.Println("T_IS_EQUAL") - // \>= fmt.Println("T_IS_GREATER_OR_EQUAL") - // === fmt.Println("T_IS_IDENTICAL") - // \!=|\<\> fmt.Println("T_IS_NOT_EQUAL") - // \!== fmt.Println("T_IS_NOT_IDENTICAL") - // \<= fmt.Println("T_IS_SMALLER_OR_EQUAL") - // \<=\> fmt.Println("T_SPACESHIP") - // __LINE__ fmt.Println("T_LINE") - // {D} fmt.Println("T_LNUMBER") // TODO: parse 0x1ac - // and fmt.Println("T_LOGICAL_AND") - // or fmt.Println("T_LOGICAL_OR") - // xor fmt.Println("T_LOGICAL_XOR") - // __METHOD__ fmt.Println("T_METHOD_C") - // -= fmt.Println("T_MINUS_EQUAL") - // %= fmt.Println("T_MOD_EQUAL") - // \*= fmt.Println("T_MUL_EQUAL") - // namespace fmt.Println("T_NAMESPACE") - // __NAMESPACE__ fmt.Println("T_NS_C") - // \\ fmt.Println("T_NS_SEPARATOR") - // new fmt.Println("T_NEW") - // -> fmt.Println("T_OBJECT_OPERATOR") - // \|= fmt.Println("T_OR_EQUAL") - // \+= fmt.Println("T_PLUS_EQUAL") - // \*\* fmt.Println("T_POW") - // \*\*= fmt.Println("T_POW_EQUAL") - // private fmt.Println("T_PRIVATE") - // public fmt.Println("T_PUBLIC") - // protected fmt.Println("T_PROTECTED") - // return fmt.Println("T_RETURN") - // \<\< fmt.Println("T_SL") - // \<\<= fmt.Println("T_SL_EQUAL") - // \>\> fmt.Println("T_SR") - // \>\>= fmt.Println("T_SR_EQUAL") - // static fmt.Println("T_STATIC") - // switch fmt.Println("T_SWITCH") - // throw fmt.Println("T_THROW") - // trait fmt.Println("T_TRAIT") - // __TRAIT__ fmt.Println("T_TRAIT_C") - // try fmt.Println("T_TRY") - // use fmt.Println("T_USE") - // var fmt.Println("T_VAR") - // while fmt.Println("T_WHILE") - // \^= fmt.Println("T_XOR_EQUAL") - // yield fmt.Println("T_YIELD") - // yield\nfrom fmt.Println("T_YIELD_FROM") - // '[^']*' fmt.Println("T_CONSTANT_ENCAPSED_STRING") - - // \{\$ fmt.Println("T_CURLY_OPEN");src.UnreadByte();c='$' - // \$[A-Za-z][A-Za-z0-9]* fmt.Println("T_VARIABLE") // TODO allow -_ and other - - // [/][*][^*]*[*]+([^*/][^*]*[*]+)*[/] fmt.Println("T_COMMENT"); - // [/][*] panic("Unterminated comment") - -%% -// \{\$ fmt.Println("T_CURLY_OPEN"); -// \$\{ fmt.Println("T_DOLLAR_OPEN_CURLY_BRACES"); - -// T_DOC_COMMENT /** */ PHPDoc-комментарии -// T_ENCAPSED_AND_WHITESPACE " $a" константная часть строки с переменными -// T_ENDDECLARE enddeclare declare, альтернативный синтаксис -// T_END_HEREDOC синтаксис heredoc -// T_START_HEREDOC <<< синтаксис heredoc -// T_EVAL eval() eval() -// T_HALT_COMPILER __halt_compiler() __halt_compiler (доступно с PHP 5.1.0) -// T_INCLUDE include() include -// T_INCLUDE_ONCE include_once() include_once -// T_INLINE_HTML текст вне PHP -// T_ISSET isset() isset() -// T_LIST list() list() -// T_NUM_STRING "$a[0]" цифровой индекс массива внутри строки -// T_PRINT print() print -// T_REQUIRE require() require -// T_REQUIRE_ONCE require_once() require_once -// T_STRING parent, self и т.п.. идентификаторы, например, ключевые слова вроде parent и self, сюда подходят также имена функций, классов и некоторые другие. Смотрите также T_CONSTANT_ENCAPSED_STRING -// T_STRING_VARNAME "${a переменные внутри строки -// T_UNSET unset() unset() -// T_VARIABLE $foo переменные - -// T_BAD_CHARACTER все, что ниже ASCII 32 исключая \t (0x09), \n (0x0a) и \r (0x0d) -// T_CONSTANT_ENCAPSED_STRING "foo" или 'bar' строковой синтаксис - - // The golex generated scanner enters top of the user code section when - // lexem recongition fails. In this example it should never happen. - fmt.Println("UNDEFENED LEXEM") - goto yystate0 - // panic("scanner internal error") - -} // *1 this right brace diff --git a/php-parser.go b/lexer.go similarity index 100% rename from php-parser.go rename to lexer.go diff --git a/php-parser.l b/lexer.l similarity index 100% rename from php-parser.l rename to lexer.l diff --git a/strings b/strings deleted file mode 100644 index f727eb5..0000000 --- a/strings +++ /dev/null @@ -1,15 +0,0 @@ -"" -"\{" -"\$" -"\"" -"$" -"$a" -"\$a" -"a$a" -"a$ " -"a$" -"{" -"{$" -"{$a" -"a{$" -"a{$a"