branch: externals/phps-mode commit 0ea731f2e5ebeae91cde61268e82c293196808ca Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
More work on trying to get automation going --- Makefile | 6 +++--- admin/phps-mode-automation.el | 39 +++++++++++++++++++-------------------- phps-mode-automation-grammar.el | 30 +++++++++++++++--------------- 3 files changed, 37 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 5157f8f..eeb1da9 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,9 @@ EMACS_CMD := $(EMACS) -Q -batch -L . clean: find . -name "*.elc" -exec rm -f {} \; -.PHONY: generate-parser -generate-parser: - $(EMACS_CMD) -L ~/.emacs.d/emacs-parser/ -l phps-mode-lexer.el -l admin/phps-mode-automation.el -e "(progn (require 'parser-generator-lr-export)(phps-mode-automation))" +.PHONY: parser +parser: + $(EMACS_CMD) -L ~/.emacs.d/emacs-parser/ -l phps-mode-lexer.el -l admin/phps-mode-automation.el -eval "(progn (require 'parser-generator-lr-export)(phps-mode-automation))" .PHONY: compile compile: diff --git a/admin/phps-mode-automation.el b/admin/phps-mode-automation.el index 1adb048..33b14e2 100644 --- a/admin/phps-mode-automation.el +++ b/admin/phps-mode-automation.el @@ -46,67 +46,66 @@ (when (fboundp 'parser-generator-set-grammar) (parser-generator-set-grammar `( - ,phps-mode-automation-grammar-non-terminals - ,phps-mode-automation-grammar-terminals - ,phps-mode-automation-grammar-productions - ,phps-mode-automation-grammar-start + ,phps-mode-automation-grammar--non-terminals + ,phps-mode-automation-grammar--terminals + ,phps-mode-automation-grammar--productions + ,phps-mode-automation-grammar--start ) )) + (when (fboundp 'parser-generator-set-look-ahead-number) (parser-generator-set-look-ahead-number - phps-mode-automation-grammar-look-ahead-number)) + phps-mode-automation-grammar--look-ahead-number)) + (when (boundp 'parser-generator--e-identifier) (setq parser-generator--e-identifier - phps-mode-automation-grammar-e-identifier)) + phps-mode-automation-grammar--e-identifier)) + (when (boundp 'parser-generator--eof-identifier) (setq parser-generator--eof-identifier - phps-mode-automation-grammar-eof-identifier)) + phps-mode-automation-grammar--eof-identifier)) + (when (boundp 'parser-generator-lex-analyzer--function) (setq parser-generator-lex-analyzer--function - phps-mode-automation-grammar-lex-analyzer-function)) + phps-mode-automation-grammar--lex-analyzer-function)) (when (boundp 'parser-generator-lex-analyzer--get-function) (setq parser-generator-lex-analyzer--get-function - phps-mode-automation-grammar-lex-analyzer-get-function)) + phps-mode-automation-grammar--lex-analyzer-get-function)) (when (boundp 'parser-generator--global-attributes) (setq parser-generator--global-attributes - phps-mode-automation-grammar-global-declaration)) + phps-mode-automation-grammar--global-attributes)) (when (boundp 'parser-generator-lr--global-precedence-attributes) (setq parser-generator-lr--global-precedence-attributes - phps-mode-lr--global-precedence-attributes)) + phps-mode-automation-grammar--lr-global-precedence-attributes)) (when (boundp 'parser-generator--context-sensitive-attributes) (setq parser-generator--context-sensitive-attributes - phps-mode-automation-grammar-context-sensitive-attributes)) + phps-mode-automation-grammar--context-sensitive-attributes)) (when (boundp 'parser-generator-lr--context-sensitive-precedence-attribute) (setq parser-generator-lr--context-sensitive-precedence-attribute - phps-mode-automation-lr--context-sensitive-precedence-attribute)) - - (when (boundp 'parser-generator-lr--precedence-attribute) - (setq - parser-generator-lr--precedence-attribute - phps-mode-automation-grammar-precendece-attribute)) + phps-mode-automation-grammar--lr-context-sensitive-precedence-attribute)) (when (boundp 'parser-generator-lr--precedence-comparison-function) (setq parser-generator-lr--precedence-comparison-function - phps-mode-automation-grammar-precedence-comparison-function)) + phps-mode-automation-grammar--precedence-comparison-function)) (when (boundp 'parser-generator--global-declaration) (setq parser-generator--global-declaration - phps-mode-automation-grammar-global-declaration)) + phps-mode-automation-grammar--global-declaration)) (when (fboundp 'parser-generator-process-grammar) (parser-generator-process-grammar)) diff --git a/phps-mode-automation-grammar.el b/phps-mode-automation-grammar.el index da7858c..fda3128 100644 --- a/phps-mode-automation-grammar.el +++ b/phps-mode-automation-grammar.el @@ -27,27 +27,27 @@ (require 'phps-mode-lexer) (defconst - phps-mode-automation-grammar-context-sensitive-attributes + phps-mode-automation-grammar--context-sensitive-attributes '(%prec) "List of context-sensitive attributes.") (defconst - phps-mode-automation-lr--context-sensitive-precedence-attribute + phps-mode-automation-grammar--lr-context-sensitive-precedence-attribute '%prec "The LR-parser's context-sensitive precedence attribute.") (defconst - phps-mode-automation-grammar-global-attributes + phps-mode-automation-grammar--global-attributes '(%left %nonassoc %precedence %right) "List of valid global attributes.") (defconst - phps-mode-lr--global-precedence-attributes + phps-mode-automation-grammar--lr-global-precedence-attributes '%prec "The LR-parser's list of global precedence attributes.") (defconst - phps-mode-automation-grammar-global-declaration + phps-mode-automation-grammar--global-declaration '( (%precedence T_THROW) (%precedence PREC_ARROW_FUNCTION) @@ -85,7 +85,7 @@ "Declaration for grammar.") (defconst - phps-mode-automation-grammar-non-terminals + phps-mode-automation-grammar--non-terminals '( absolute_trait_method_reference alt_if_stmt @@ -244,7 +244,7 @@ "The non-terminals in grammar.") (defconst - phps-mode-automation-grammar-terminals + phps-mode-automation-grammar--terminals '( "!" "%" @@ -456,12 +456,12 @@ "The terminals of grammar.") (defconst - phps-mode-automation-grammar-look-ahead-number + phps-mode-automation-grammar--look-ahead-number 1 "The look-ahead number of grammar.") (defconst - phps-mode-automation-grammar-productions + phps-mode-automation-grammar--productions '( (start @@ -1429,22 +1429,22 @@ "The productions of grammar.") (defconst - phps-mode-automation-grammar-start + phps-mode-automation-grammar--start 'start "The entry-point of grammar.") (defconst - phps-mode-automation-grammar-e-identifier + phps-mode-automation-grammar--e-identifier '%empty "The e-identifier of grammar.") (defconst - phps-mode-automation-grammar-eof-identifier + phps-mode-automation-grammar--eof-identifier '$ "The EOF-identifier of grammar.") (defconst - phps-mode-automation-grammar-lex-analyzer-function + phps-mode-automation-grammar--lex-analyzer-function (lambda(index) (with-current-buffer "*phps-mode-lex-analyzer*" (unless (= (point) index) @@ -1459,7 +1459,7 @@ "The custom lex-analyzer.") (defconst - phps-mode-automation-grammar-precedence-comparison-function + phps-mode-automation-grammar--precedence-comparison-function (lambda(a-type a-value _b-type b-value) (cond @@ -1501,7 +1501,7 @@ "The precedence comparison function of the grammar.") (defconst - phps-mode-automation-grammar-lex-analyzer-get-function + phps-mode-automation-grammar--lex-analyzer-get-function (lambda (token) (with-current-buffer "*phps-mode-lex-analyzer*" (let ((start (car (cdr token)))