jade-lexer

The jade lexer (takes a string and converts it to an array of tokens)

jade-lexer will be unpublished soon, please use pug-lexer
Last updated 5 years ago by timothygu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jade-lexer 
SYNC missed versions from official npm registry.

jade-lexer

The jade lexer. This module is responsible for taking a string and converting it into an array of tokens.

Build Status Dependency Status NPM version

Installation

npm install jade-lexer

Usage

var lex = require('jade-lexer');

lex(str, filename)

Convert Jade string to an array of tokens. filename, if provided, is used in error handling.

console.log(JSON.stringify(lex('div(data-foo="bar")', 'my-file.jade'), null, '  '))
[
  {
    "type": "tag",
    "line": 1,
    "val": "div",
    "selfClosing": false
  },
  {
    "type": "attrs",
    "line": 1,
    "attrs": [
      {
        "name": "data-foo",
        "val": "\"bar\"",
        "escaped": true
      }
    ]
  },
  {
    "type": "eos",
    "line": 1
  }
]

new lex.Lexer(str, filename, options)

Constructor for a Lexer class. This is not meant to be used directly unless you know what you are doing.

options may contain the following properties:

  • interpolated (boolean): if the Lexer is created as a child lexer for inline tag interpolation (e.g. #[p Hello]). Defaults to false.
  • startingLine (integer): the real line number of the first line in the input. It is also used for inline tag interpolation. Defaults to 1.

License

MIT

Current Tags

  • 0.0.9                                ...           latest (5 years ago)

9 Versions

  • 0.0.9 [deprecated]           ...           5 years ago
  • 0.0.8 [deprecated]           ...           5 years ago
  • 0.0.7 [deprecated]           ...           5 years ago
  • 0.0.6 [deprecated]           ...           5 years ago
  • 0.0.5 [deprecated]           ...           5 years ago
  • 0.0.4 [deprecated]           ...           5 years ago
  • 0.0.3 [deprecated]           ...           6 years ago
  • 0.0.2 [deprecated]           ...           6 years ago
  • 0.0.1 [deprecated]           ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (3)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |