Module: RedParse::MacroMixin
- Included in:
- WithMacros
- Defined in:
- lib/macro.rb
Instance Method Summary collapse
- #addl_node_containers ⇒ Object
-
#beginsendsmatcher ⇒ Object
A regex for all the keywords that can be terminated with the ‘end’ keyword.
- #initialize(*args, &block) ⇒ Object
- #PRECEDENCE ⇒ Object
- #redparse_modules_init ⇒ Object
- #reduce_withs_directory ⇒ Object
- #rubykeywordlist ⇒ Object
- #rubyoperatorlist ⇒ Object
- #RULES ⇒ Object
- #wants_semi_context ⇒ Object
Instance Method Details
#addl_node_containers ⇒ Object
987 |
# File 'lib/macro.rb', line 987 def addl_node_containers; [::Macro] end |
#beginsendsmatcher ⇒ Object
A regex for all the keywords that can be terminated with the ‘end’ keyword
We use the base class’s list, and add the ‘macro’ keyword to it.
971 972 973 |
# File 'lib/macro.rb', line 971 def beginsendsmatcher return @bem||=/#{super}|^macro$/ end |
#initialize(*args, &block) ⇒ Object
989 990 991 |
# File 'lib/macro.rb', line 989 def initialize(*args,&block) super end |
#PRECEDENCE ⇒ Object
938 939 940 941 |
# File 'lib/macro.rb', line 938 def PRECEDENCE result=super return result.merge({"^@"=>result["+@"], "v"=>result[";"]}) end |
#redparse_modules_init ⇒ Object
925 926 927 928 929 930 931 932 933 934 935 936 |
# File 'lib/macro.rb', line 925 def redparse_modules_init if defined? @lexer and @lexer.respond_to? :enable_macros! @lexer.enable_macros! @lexer.extend ::RubyLexer::MacroMixin @lexer.rubylexer_modules_init end # binary @unary_or_binary_op=/^([\^:]|#@unary_or_binary_op)$/ super end |
#reduce_withs_directory ⇒ Object
975 976 977 |
# File 'lib/macro.rb', line 975 def reduce_withs_directory "macro" end |
#rubykeywordlist ⇒ Object
983 984 985 |
# File 'lib/macro.rb', line 983 def rubykeywordlist super+%w[macro v] end |
#rubyoperatorlist ⇒ Object
979 980 981 |
# File 'lib/macro.rb', line 979 def rubyoperatorlist super+%w[:@ ^@ v] end |
#RULES ⇒ Object
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 |
# File 'lib/macro.rb', line 943 def RULES @@soft_nl||=KW(';')&-{:not_real? =>false} [ -[KW('macro'), KW(beginsendsmatcher).~.*, KW('end'), KW(/^(do|\{)$/).~.la]>>MisparsedNode ]+super+[ -['<+', Expr, '+>']>>FormEscapeNode, -[Op('v'), Expr, lower_op()]>>FormEscapeNode, -[Op('v'), Expr, /^;$|^<doubled-parens>$/, '(', Expr.-, ')']>>FormEscapeNode, #constructor needs update -[Op('v'), Expr, ';', KW('(').~.la]>>FormEscapeNode, -[Op('v'), Expr, @@soft_nl.la]>>:shift, -[Op('^@'), Expr, lower_op()]>>FormEscapeNode, -[Op(':@'), (ParenedNode&-{:size=>(0..1)})|(SequenceNode&-{:size=>0})]>>FormNode, -['macro', CallSiteNode, KW(';'), Expr.-, RescueNode.*, ElseNode.-, EnsureNode.-, 'end' ]>>MacroNode, -[ '(', Expr.-, ')', '<doubled-parens>', '(', Expr.-, ')', BlockNode.-, KW('do').~.la]>>CallNode, #constructor needs update ] end |
#wants_semi_context ⇒ Object
962 963 964 |
# File 'lib/macro.rb', line 962 def wants_semi_context super|KW('macro') end |