Module: RedParse::BareSymbolUtils
Instance Method Summary collapse
Instance Method Details
#baresym2str(node) ⇒ Object
4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 |
# File 'lib/redparse/node.rb', line 4960 def (node) case node when MethNameToken; node.ident when VarNode; node when LiteralNode case node.val when Symbol node.val.to_s when StringNode; node.val # when StringToken: StringNode.new(node.val) else fail end end end |
#str2parsetree(str, o) ⇒ Object
4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 |
# File 'lib/redparse/node.rb', line 4988 def str2parsetree(str,o) if String===str str=str.chop if /^[!~]@$/===str [:lit, str.to_sym] else result=str.parsetree(o) result[0]=:dsym result end end |
#str_unparse(str, o) ⇒ Object
4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 |
# File 'lib/redparse/node.rb', line 4975 def str_unparse(str,o) case str when VarNode; str.ident when "~@"; str when String str.to_sym.inspect #what if str isn't a valid method or operator name? should be quoted when StringNode ":"+str.unparse(o) else fail end end |