apg-js-examples
Version:
Examples of using the suite of apg-js applications and libraries.
62 lines (57 loc) • 2.23 kB
JavaScript
// copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved<br>
// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
//
// Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)
module.exports = function grammar(){
// ```
// SUMMARY
// rules = 1
// udts = 1
// opcodes = 10
// --- ABNF original opcodes
// ALT = 1
// CAT = 1
// REP = 0
// RNM = 1
// TLS = 5
// TBS = 0
// TRG = 0
// --- SABNF superset opcodes
// UDT = 1
// AND = 0
// NOT = 0
// BKA = 0
// BKN = 0
// BKR = 1
// ABG = 0
// AEN = 0
// characters = [46 - 62] + user defined
// ```
/* OBJECT IDENTIFIER (for internal parser use) */
this.grammarObject = 'grammarObject';
/* RULES */
this.rules = [];
this.rules[0] = { name: 'HTML', lower: 'html', index: 0, isBkr: false };
/* UDTS */
this.udts = [];
this.udts[0] = { name: 'u_name', lower: 'u_name', index: 0, empty: false, isBkr: true };
/* OPCODES */
/* HTML */
this.rules[0].opcodes = [];
this.rules[0].opcodes[0] = { type: 1, children: [1,9] };// ALT
this.rules[0].opcodes[1] = { type: 2, children: [2,3,4,5,6,7,8] };// CAT
this.rules[0].opcodes[2] = { type: 7, string: [60] };// TLS
this.rules[0].opcodes[3] = { type: 11, empty: false, index: 0 };// UDT(u_name)
this.rules[0].opcodes[4] = { type: 7, string: [62] };// TLS
this.rules[0].opcodes[5] = { type: 4, index: 0 };// RNM(HTML)
this.rules[0].opcodes[6] = { type: 7, string: [60,47] };// TLS
this.rules[0].opcodes[7] = { type: 14, index: 1, lower: 'u_name', bkrCase: 604, bkrMode: 601 };// BKR(\%i%uu_name)
this.rules[0].opcodes[8] = { type: 7, string: [62] };// TLS
this.rules[0].opcodes[9] = { type: 7, string: [46,46,46] };// TLS
// The `toString()` function will display the original grammar file(s) that produced these opcodes.
this.toString = function toString(){
let str = "";
str += "HTML = \"<\" u_name \">\" HTML \"</\" \\%i%uu_name \">\" / \"...\"\n";
return str;
}
}