Class: Syntax::Javascript

### Home Classes Methods

### In Files

- lib/syntax/lang/javascript.rb

### Parent

Syntax::Tokenizer

### Methods

- #step

### Class/Module Index

Quicksearch

- Syntax
- Syntax::AnsiC
- Syntax::CSS21
- Syntax::Convertors
- Syntax::Convertors::Abstract
- Syntax::Convertors::HTML
- Syntax::Default
- Syntax::Fortran
- Syntax::Javascript
- Syntax::Ruby
- Syntax::SQLite
- Syntax::Token
- Syntax::Tokenizer
- Syntax::Version
- Syntax::XML
- Syntax::YAML

No matching classes.

# Syntax::Javascript

### Constants

JAVASCRIPT_KEYWORDS
JAVASCRIPT_PREDEFINED_CONSTANTS
JAVASCRIPT_PREDEFINED_TYPES

### Public Instance Methods

step() click to toggle source

    # File lib/syntax/lang/javascript.rb, line 23
    def step
      case
      when scan(/\s+/)
        start_group :normal, matched
      when scan(/\\u[0-9a-f]{4}/)
        start_group :unicode, matched
      when scan(/0[xX][0-9A-Fa-f]+/)
        start_group :hex, matched
      when scan(/(?:0[0-7]+)(?![89.eEfF])/)
        start_group :oct, matched
      when scan(/(?:\d+)(?![.eEfF])/)
        start_group :integer, matched
      when scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
        start_group :float, matched
      when (scan(/"(?:[^"\\]|\\.)*"/) or scan(/'(?:[^'\\]|\\.)*'/) )
        start_group :string, matched
      when scan(/[a-z_$][a-z_\d]*/)
        if JAVASCRIPT_KEYWORDS.include?( matched )
          start_group :keyword, matched
        elsif JAVASCRIPT_PREDEFINED_TYPES.include?( matched )
          start_group :predefined_types, matched
        else
          start_group :ident, matched
        end
      when scan(% // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !x)
        start_group :comment, matched
      else
        start_group :other, scan(/./)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.