class Macro::FormParameterNode
The syntax node for a form escape
Public Class Methods
create(*args)
click to toggle source
def initialize(*args) super(args.last) end
# Called by the parser to create a new form parameter node. #
- #
args
-
the ^ token (unused), and its argument
#
# File lib/macro/form.rb, line 291 def self.create(*args) v=args.last case v when UndefNode; v=MisparsedNode.new('',v,'') when KeywordToken case v.ident when /\A(?:;|\+>)\z/; v=args[-2] when ')'; huh "v foo;(*params) unhandled yet" else fail end end new v end
Public Instance Methods
image()
click to toggle source
# File lib/macro.rb, line 736 def image "^"+body.image end
lhs_unparse(o=default_unparse_options)
click to toggle source
# File lib/macro/form.rb, line 314 def lhs_unparse o=default_unparse_options "(^"+val.unparse(o)+")" end
reducer_ident()
click to toggle source
# File lib/macro/ReduceWithsFor_RedParse_RedParse__MacroMixin_RedParse__WithMacros_1_8.rb, line 18867 def reducer_ident :FormEscapeNode end
to_sexp(session)
click to toggle source
Convert this node to an S-expression
session
-
the context in which this macro is being processed
Calls superclass method
# File lib/macro.rb, line 721 def to_sexp session nest=session[:form_nest_level]||1 carets=0 node=self while FormEscapeNode===node node=node.text carets+=1 end if carets==nest return node.unparse else return super end end
unparse(o=default_unparse_options)
click to toggle source
Performs the reverse of a parse operation (turns the node into a string)
o
-
a list of options for unparse
# File lib/macro/form.rb, line 310 def unparse o=default_unparse_options "^"+val.unparse(o) end
wraplevel()
click to toggle source
The number of carats (^) that occur in the escape. Note that this method is recursive.
# File lib/macro/form.rb, line 320 def wraplevel return val.wraplevel+1 if FormEscapeNode===val return 1 end