Socket
Socket
Sign inDemoInstall

moo

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moo - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

2

moo.js

@@ -377,3 +377,3 @@ (function(root, factory) {

type: (group.getType && group.getType(text)) || group.tokenType,
value: (group.value && group.value(text)) || text,
value: group.value ? group.value(text) : text,
text: text,

@@ -380,0 +380,0 @@ toString: tokenToString,

{
"name": "moo",
"version": "0.4.2",
"version": "0.4.3",
"description": "Optimised tokenizer/lexer generator! πŸ„ Much performance. Moo!",

@@ -5,0 +5,0 @@ "main": "moo.js",

@@ -125,4 +125,13 @@ ![](cow.png)

It will track line numbers, as long as you apply the `lineBreaks: true` option to any tokens which might contain newlines. Moo will try to warn you if you forget to do this.
It will track line numbers, as long as you **apply the `lineBreaks: true` option to any rules which might contain newlines**. Moo will try to warn you if you forget to do this.
Note that this is `false` by default, for performance reasons: counting the number of lines in a matched token has a small cost. For optimal performance, only match newlines inside a dedicated token:
```js
newline: {match: '\n', lineBreaks: true},
```
### Token Info ###
Token objects (returned from `next()`) have the following attributes:

@@ -181,2 +190,5 @@

### Why? ###
You need to do this to ensure the **longest match** principle applies, even in edge cases.

@@ -187,4 +199,4 @@

```js
['keyword', ['class']],
['identifier', /[a-zA-Z]+/],
keyword: ['class'],
identifier: /[a-zA-Z]+/,
```

@@ -196,2 +208,5 @@

### Keyword Types ###
Keywords can also have **individual types**.

@@ -214,3 +229,3 @@

Use [itt](https://github.com/nathan/itt)'s iterator adapters to make constructing keyword objects easier:
You can use [itt](https://github.com/nathan/itt)'s iterator adapters to make constructing keyword objects easier:

@@ -217,0 +232,0 @@ ```js

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc