Sha256: 7ac7c174165ec8ef1da2c06372cd15bf3526d61066573cd225fb38301803736a

Contents?: true

Size: 891 Bytes

Versions: 28

Compression:

Stored size: 891 Bytes

Contents

grammar EbnfJavascript
  include Basic
  rule primitive
    js_all_caps_constant / js_namespace / js_constant  / js_variable / js_object
  end
  
  rule js_object
    '{' [^}]* '}'
  end
  
  rule js_constant
    [A-Z] [a-zA-Z_0-9$]* {
      def value
        text_value
      end
    }
  end

  rule js_all_caps_constant
    [A-Z] [A-Z_]+ {
      def value
        text_value
      end
    }
  end
  
  rule js_variable
    [_a-zA-Z] [_a-zA-Z0-9]* {
      def value
        text_value
      end
    }
  end
  
  rule js_namespace
    (js_constant / js_all_caps_constant / js_variable) ('.' (js_constant / js_all_caps_constant / js_variable))* {
      def namespace
        to_a.slice(0..-2).join(".")
      end
    
      def name
        to_a.pop
      end
    
      def to_a
        text_value.split('.')
      end
      
      def full_name
        text_value
      end
    }
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
distil-0.12.6 vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop
distil-0.12.4 vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop
distil-0.12.3 vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop
distil-0.12.2 vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop
distil-0.12.1 vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop
pdoc-0.2.0 lib/pdoc/parser/treetop_files/ebnf_javascript.treetop
distil-0.12.0 vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop
distil-0.11.8 vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop