Module: Fdlint::Parser::JS::Expr::Operate
- Included in:
- Expr
- Defined in:
- lib/fdlint/parser/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
85 86 87 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 85 def expr_operate_not_in=(value) @operate_not_in = !!value end |
#expr_operate_not_in? ⇒ Boolean
81 82 83 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 81 def expr_operate_not_in? @operate_not_in || false end |
#parse_expr_add ⇒ Object
34 35 36 37 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 34 def parse_expr_add log 'parse expr add' parse_expr_with_operate :parse_expr_mul, /(?:\+|-)(?!=)/ end |
#parse_expr_bit_and ⇒ Object
56 57 58 59 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 56 def parse_expr_bit_and log 'parse expr bit and' parse_expr_with_operate :parse_expr_equal, /&(?![&=])/ end |
#parse_expr_bit_or ⇒ Object
66 67 68 69 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 66 def parse_expr_bit_or log 'parse expr bit or' parse_expr_with_operate :parse_expr_bit_xor, /\|(?![|=])/ end |
#parse_expr_bit_xor ⇒ Object
61 62 63 64 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 61 def parse_expr_bit_xor log 'parse expr bit xor' parse_expr_with_operate :parse_expr_bit_and, /\^(?!=)/ end |
#parse_expr_equal ⇒ Object
51 52 53 54 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 51 def parse_expr_equal log 'parse expr equal' parse_expr_with_operate :parse_expr_relation, /===|!==|==|!=/ end |
#parse_expr_logical_and ⇒ Object
71 72 73 74 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 71 def parse_expr_logical_and log 'parse expr logical and' parse_expr_with_operate :parse_expr_bit_or, /&&/ end |
#parse_expr_logical_or ⇒ Object
76 77 78 79 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 76 def parse_expr_logical_or log 'parse expr logical or' parse_expr_with_operate :parse_expr_logical_and, /\|\|/ end |
#parse_expr_mul ⇒ Object
29 30 31 32 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 29 def parse_expr_mul log 'parse expr mul' parse_expr_with_operate :parse_expr_unary, /(?:\*|\/|%)(?!=)/ end |
#parse_expr_postfix ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 8 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
44 45 46 47 48 49 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 44 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
39 40 41 42 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 39 def parse_expr_shift log 'parse expr shift' parse_expr_with_operate :parse_expr_add, /(?:<<|>>>|>>)(?!=)/ end |
#parse_expr_unary ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fdlint/parser/js/expr/operate.rb', line 18 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, scanner_pos else parse_expr_postfix end end |