Module: XRay::JS::Expr::Operate
- Included in:
- Expr
- Defined in:
- lib/js/expr/operate.rb
Instance Method Summary collapse
- #expr_operate_not_in=(value) ⇒ Object
- #expr_operate_not_in? ⇒ Boolean
- #parse_expr_add ⇒ Object
- #parse_expr_bit_and ⇒ Object
- #parse_expr_bit_or ⇒ Object
- #parse_expr_bit_xor ⇒ Object
- #parse_expr_equal ⇒ Object
- #parse_expr_logical_and ⇒ Object
- #parse_expr_logical_or ⇒ Object
- #parse_expr_mul ⇒ Object
- #parse_expr_postfix ⇒ Object
- #parse_expr_relation ⇒ Object
- #parse_expr_shift ⇒ Object
- #parse_expr_unary ⇒ Object
Instance Method Details
#expr_operate_not_in=(value) ⇒ Object
84 85 86 |
# File 'lib/js/expr/operate.rb', line 84 def expr_operate_not_in=(value) @operate_not_in = !!value end |
#expr_operate_not_in? ⇒ Boolean
80 81 82 |
# File 'lib/js/expr/operate.rb', line 80 def expr_operate_not_in? @operate_not_in || false end |
#parse_expr_add ⇒ Object
33 34 35 36 |
# File 'lib/js/expr/operate.rb', line 33 def parse_expr_add log 'parse expr add' parse_expr_with_operate :parse_expr_mul, /(?:\+|-)(?!=)/ end |
#parse_expr_bit_and ⇒ Object
55 56 57 58 |
# File 'lib/js/expr/operate.rb', line 55 def parse_expr_bit_and log 'parse expr bit and' parse_expr_with_operate :parse_expr_equal, /&(?![&=])/ end |
#parse_expr_bit_or ⇒ Object
65 66 67 68 |
# File 'lib/js/expr/operate.rb', line 65 def parse_expr_bit_or log 'parse expr bit or' parse_expr_with_operate :parse_expr_bit_xor, /\|(?![|=])/ end |
#parse_expr_bit_xor ⇒ Object
60 61 62 63 |
# File 'lib/js/expr/operate.rb', line 60 def parse_expr_bit_xor log 'parse expr bit xor' parse_expr_with_operate :parse_expr_bit_and, /\^(?!=)/ end |
#parse_expr_equal ⇒ Object
50 51 52 53 |
# File 'lib/js/expr/operate.rb', line 50 def parse_expr_equal log 'parse expr equal' parse_expr_with_operate :parse_expr_relation, /===|!==|==|!=/ end |
#parse_expr_logical_and ⇒ Object
70 71 72 73 |
# File 'lib/js/expr/operate.rb', line 70 def parse_expr_logical_and log 'parse expr logical and' parse_expr_with_operate :parse_expr_bit_or, /&&/ end |
#parse_expr_logical_or ⇒ Object
75 76 77 78 |
# File 'lib/js/expr/operate.rb', line 75 def parse_expr_logical_or log 'parse expr logical or' parse_expr_with_operate :parse_expr_logical_and, /\|\|/ end |
#parse_expr_mul ⇒ Object
28 29 30 31 |
# File 'lib/js/expr/operate.rb', line 28 def parse_expr_mul log 'parse expr mul' parse_expr_with_operate :parse_expr_unary, /(?:\*|\/|%)(?!=)/ end |
#parse_expr_postfix ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/js/expr/operate.rb', line 7 def parse_expr_postfix log 'parse expr postfix' expr = parse_expr_lefthand if check(/[ \t]*(?:\+\+|--)/, true) op = scan /\+\+|--/ expr = create_element Expression, op.text, expr end expr end |
#parse_expr_relation ⇒ Object
43 44 45 46 47 48 |
# File 'lib/js/expr/operate.rb', line 43 def parse_expr_relation not_in = expr_operate_not_in? log "parse expr relational#{not_in ? '(notin)' : ''}" pattern = not_in ? (/>=|<=|>|<|\binstanceof\b/) : (/>=|<=|>|<|\binstanceof\b|\bin\b/) parse_expr_with_operate :parse_expr_shift, pattern end |
#parse_expr_shift ⇒ Object
38 39 40 41 |
# File 'lib/js/expr/operate.rb', line 38 def parse_expr_shift log 'parse expr shift' parse_expr_with_operate :parse_expr_add, /(?:<<|>>>|>>)(?!=)/ end |
#parse_expr_unary ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/js/expr/operate.rb', line 17 def parse_expr_unary log 'parse expr unary' r = /delete|void|typeof|\+\+|--|\+|-|~|!/ if check r op = scan r create_element Expression, op.text, nil, parse_expr_unary else parse_expr_postfix end end |