Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apg

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apg - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

2

index.md

@@ -28,3 +28,3 @@ **Annotated Table of Contents**<br>

The semantic phase will generate rule and opcode arrays.
Generates the grammar object>
Generates the grammar object
>[abnf-for-sabnf-parser.js](abnf-for-sabnf-parser.html)<br>

@@ -31,0 +31,0 @@ >[syntax-callbacks.js](./syntax-callbacks.html)<br>

{
"name": "apg",
"version": "2.1.0",
"version": "2.1.1",
"description": "An ABNF Parser Generator - generates recursive-descent parsers from grammars written in a superset of Augmented Backus-Naur Form (ABNF)",

@@ -5,0 +5,0 @@ "main": "./src/exports.js",

@@ -6,3 +6,3 @@ ##JavaScript APG

**APG** is an acronym for "ABNF Parser Generator". Originally written to generate parsers directly from ABNF syntax
([RFC 5234](https://tools.ietf.org/html/rfc5234)) it has since grown to include a number of additional features requiring additional syntax terms. The resulting syntax is a superset of ABNF or [SABNF](https://github.com/ldthomas/apg-js2/SABNF.md).
([RFC 5234](https://tools.ietf.org/html/rfc5234)) it has since grown to include a number of additional features requiring additional syntax terms. The resulting syntax is a superset of ABNF or [SABNF](https://github.com/ldthomas/apg-js2/blob/master/SABNF.md).
This version adds a number of new features to the last, primarily to support the new [`apg-exp`](https://github.com/ldthomas/apg-js2-exp) pattern-matching application.

@@ -52,3 +52,3 @@

</ul>
More complete explanations of these features can be found in the [SABNF](https://github.com/ldthomas/apg-js2/SABNF.md) documentation, in the code file documentation and the [examples](https://github.com/ldthomas/apg-js2-examples).
More complete explanations of these features can be found in the [SABNF](https://github.com/ldthomas/apg-js2/blob/master/SABNF.md) documentation, in the code file documentation and the [examples](https://github.com/ldthomas/apg-js2-examples).

@@ -55,0 +55,0 @@ **Installation:**

@@ -50,3 +50,3 @@ # Superset Augmented Backus-Naur Form (SABNF)

%d48-57 - represents any single character code in the decimal range 48 through 57
that is, any ASCII digit `0, 1, 2, 3 ,4, 5, 6, 7, 8 or 9`
that is, any ASCII digit 0, 1, 2, 3 ,4, 5, 6, 7, 8 or 9
%x30-39 - represents any single character code in the hexidecimal range 30 through 39

@@ -100,4 +100,4 @@ (also any ASCII digit)

```
Note: `0*0` is not allowed and a syntax error will be generated. The only way to explicitly
define an empty string is with the literal string operator, `""`;
<i>Note: <code>0*0</code> is not allowed and a syntax error will be generated. The only way to explicitly
define an empty string is with the literal string operator, <code>""</code>.</i>

@@ -131,3 +131,3 @@ **Groups:**

```
Note that empty lines and comment-only lines are accepted as white space,
In this implementation empty lines and comment-only lines are accepted as white space,
but any line beginning with one or more space/tab characters and having text not beginning

@@ -190,3 +190,3 @@ with a semicolon will be rejected as an ABNF syntax error.

Only if the UDT name begins with `e_` is an empty phrase return accepted. The difference has to do with
the rule [attributes]() and will not be discussed here further.
the [rule attributes](https://github.com/ldthomas/apg-js2/blob/master/src/attributes.js) and will not be discussed here further.

@@ -208,3 +208,3 @@ Note the even though UDTs are terminal phrases, they are also named phrases and share some of the named-phrase

`phrase2` uses the negative look ahead operator. It works just as described above except that it succeeds if
`"+` is *not* found and fails if it is.
`"+"` is *not* found and fails if it is.

@@ -219,3 +219,3 @@ As far as I can tell, the positive look ahead operator was first introduced by Parr and Quong and the negative

phrase1 = any-text &&line-end text CRLF
phrase1 = any-text !!line-end text CRLF
phrase2 = any-text !!line-end text CRLF
text = *%d32-126 CRLF

@@ -232,3 +232,4 @@ any-text = *(%d10 / %d13 / %d32-126) CRLF

rules or UDTs. If needed, special rules can be written to work in look behind mode and an example of
that is given in the [examples](). Also, there is a flag available to the author of UDTs and they
that is given in the [examples](https://github.com/ldthomas/apg-js2-examples/tree/master/look-behind).
Also, there is a flag available to the author of UDTs and they
could also be written to work in look behind mode. However, as a general practice, it is safest

@@ -279,5 +280,5 @@ to assume that rules and UDTs do not work right-to-left and avoid the use of them altogether in look behind phrases.

Practically speaking, when a back referenced rule is matched the phrase is stored in two places.
Once in the root rule call stack frame and once in the parent rule call stack frame.
`\%uX` will always refer to the last value saved in the root rule call stack frame.
`\%pX` will always refer to the last value saved in the parent rule call stack frame.
Once in a single, universal object and again in the parent rule call stack frame.
`\%uX` will always refer to the last phrase saved in the universal object.
`\%pX` will always refer to the last phrase saved in the parent rule call stack frame.

@@ -294,7 +295,7 @@ Case insensitive and universal mode are the defaults unless otherwise specified.

but by using parent frame mode back references, it is also possible to match the tag names.
An example of this is in the [examples]().
An example of this is in the [examples](https://github.com/ldthomas/apg-js2-examples/tree/master/back-reference).
**Anchors:**
Primarily to aid the new pattern matching engine
[`apg-exp`](), SABNF includes two specific anchors, the beginning
[`apg-exp`](https://github.com/ldthomas/apg-js2-exp), SABNF includes two specific anchors, the beginning
and ending of a string.

@@ -331,3 +332,3 @@ ```

##ABNF for SABNF
RFC 5234 defines the ABNF syntax for the ABNF syntax. While this may seem paradoxical, it makes sense when you realize that a parser generator is a parser whose semantic phase generates a parser. In this case, both the parser of the generator and the parser it generates are defined with an ABNF syntax. Confusing? Here is what the ABNF (no superset features required) for SABNF looks like. It is more elaborate than that given in RFC 5234 partially because of the extra features but mostly because many "error" rules have been added so that the parser can catch input errors and report them rather than just fail to parse correctly. The latest version can always be found [here](https://github.com/ldthomas/apg-js2/blob/master/resources/ABNFforSABNF.bnf).
RFC 5234 defines the ABNF syntax for the ABNF syntax. While this may seem paradoxical, it makes sense when you realize that a parser generator is a parser whose semantic phase generates a parser. In this case, both the parser of the generator and the parser it generates are defined with an ABNF syntax. Confusing? Here is what the ABNF (no superset features required) for SABNF looks like. It is more elaborate than that given in RFC 5234 partially because of the extra features but mostly because many "error" rules have been added so that the parser can catch input errors and report them rather than just fail to parse correctly. The latest version can always be found [here](https://github.com/ldthomas/apg-js2/blob/master/resources/abnf-for-sabnf-grammar.bnf).
```

@@ -334,0 +335,0 @@ File = *(BlankLine / Rule / RuleError)

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