How to use the jison.Parser function in jison

To help you get started, we’ve selected a few jison examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fulup-bzh / GeoGate / encoder / bin / Ais2JsonClient.js View on Github external
,['OPTIONS OPTION', ""]
        ]
        ,'OPTION' : [["EOL"      , "return (this);"]
           ,['HOS TEX'  ,"this.hostname=$2"]
           ,['PRT TEX'  ,"this.port=parseInt($2)"]
           ,['IME TEX'  ,"this.mmsi=parseInt($2)"]
           ,['MSG TEX'  ,"this.type=parseInt($2)"]
           ,['DEB TEX'  ,"this.debug=$2"]
           ,['DUM TEX'  ,"this.dumpfile=$2"]
           ,['VER'      ,"this.verbose=true"]
           ,['HLP'      ,"this.help=true"]
           ]
    }};

    // instanciate command line parser
    var parser=new jison (cmdgrammar);
   
    try {this.opts = parser.parse (args.toString());}
     catch (err) {
        console.log ("Syntax error [please check --help] err=[%s]", err);
        this.error=true;
        return;
    }
    
    // get basename from command line
    var cmd= command.split ('/');
    var bin= cmd[cmd.length -1];

    // if help call then display help and exit
    if (this.opts.help)  {
        console.log ("----------------------------------------------------------------------------------------------------------");
        console.log ("## Syntaxe:  %s --hostname=xxxx --port=xxxx [--mmsi=xxx] [--dumpfile=xxx] \\",bin);
github fulup-bzh / GeoGate / simulator / bin / DevSimulator.js View on Github external
,['WID TEX'  ,"this.wid=parseInt($2)"]
           ,['LEN TEX'  ,"this.len=parseInt($2)"]
           ,['CAR TEX'  ,"this.cargo=parseInt($2)"]
           ,['WAY TEX'  ,"this.uway=parseInt($2)"]
           ,['SRC TEX'  ,"this.srvmod=JSON.parse($2)"]
           ,['LOP TEX'  ,"this.loopwait=parseInt($2*1000)"] // millisecond
           ,['RAN TEX'  ,"this.randomize=$2"]
           ,['VER'      ,"this.verbose=true"]
           ,['SRV'      ,"this.srvmod=true"]
           ,['PAR'      ,"this.testpar=true"]
           ,['HLP'      ,"this.help=true"]
           ]
    }};

    // instanciate command line parser
    var parser=new jison (cmdgrammar);
        var arguments= args.toString();
        this.opts = parser.parse (arguments);
   
    // get basename from command line
    var cmd= command.split ('/');
    var bin= cmd[cmd.length -1];

    // if help call then display help and exit
    if (this.opts.help)  {
        console.log ("----------------------------------------------------------------------------------------------------------");
        console.log ("## Client:  %s --gpxfile=./your-gpxfile.gpx [--proto=gprmc] [--speed=12] [--tic=2] \\",bin);
        console.log ("            [--srvmod | --hostname=localhost] [--port=5000] \\");
        console.log ("            [--dumpgpxfile=xxx] [--loopwait=timeout] [--debug=4]");
        console.log ("## Server:  %s --gpxfile=./your-gpxfile.gpx [--proto=aivdm]  [--speed=6]  [--tic=30] \\", bin);
        console.log ("            [--srvmod | --hostname=localhost] [port=5000] [--debug=4]\\");
        console.log ("            [--shipname=xxx] [--cargo=xxx] [--callsign=xxx] [--underway=xx] [--width=xxx] [--length=xxx]");
github fulup-bzh / GeoGate / simulator / bin / HubSimulator.js View on Github external
,['OPTIONS OPTION', ""]
            ]
            ,'OPTION' : [["EOL"      , "return (this);"]
                ,['GPX TEX'  ,"this.gpxdir=$2 + '/' ;"]
                ,['TIC TEX'  ,"this.tic=parseInt($2);"]
                ,['PRT TEX'  ,"this.port=parseInt($2)"]
                ,['DEB TEX'  ,"this.debug=$2"]
                ,['DUM TEX'  ,"this.dumpfile=$2"]
                ,['LOP TEX'  ,"this.loopwait=parseInt($2*1000)"] // millisecond
                ,['VER'      ,"this.verbose=true"]
                ,['HLP'      ,"this.help=true"]
            ]
        }};

    // instanciate command line parser
    var parser=new jison (cmdgrammar);

    this.opts = parser.parse (args.toString());
    
    // get basename from command line
    var cmd= command.split ('/');
    var bin= cmd[cmd.length -1];

    // if help call then display help and exit
    if (this.opts.help)  {
        console.log ("----------------------------------------------------------------------------------------------------------");
        console.log ("## %s --gpxdir=./xxx --port=1234 --verbose \\",bin);
        console.log ("## %s --gpxdir=./sample/hub-route --port=5001 \\",bin);
        console.log ("----------------------------------------------------------------------------------------------------------");
    }
};
github lovasoa / musreact / grammar.js View on Github external
// myparser.js
var fs = require("fs");
var jison = require("jison");

var bnf = fs.readFileSync(__dirname+"/grammar.jison", "utf8");
var parser = new jison.Parser(bnf);

module.exports = parser;
github fulup-bzh / GeoGate / server / adapters / TraccarDroid-adapter.js View on Github external
]
        , 'FLOATSEP'   : [
                ["FLOAT SEP", "$$=$1"]
        ]
        , 'INTSEP'   : [
                ["INT SEP", "$$=$1"]
        ]
    }};

    this.id        = controller.svc;
    this.uid       = "//" + controller.svcopts.adapter + "/" + controller.svc + ":" +  controller.svcopts.port;;
    this.control   = 'tcpsock';
    this.info      = 'TraccarDroid';
    this.debug     =  controler.svcopts.debug;  // inherit debug from controler
    this.controler = controler;  // keep a link to device controler and TCP socket
    this.parser    = new Jison(grammar);
    this.Debug (1,"uid=%s", this.uid);    
};
github fulup-bzh / GeoGate / server / adapters / TelnetConsole-adapter.js View on Github external
,["SEND HELP TXT"         , "this.cmd='SEND'; this.devid=$3; this.action='help';"]
        ]
        ,'ARGS':[
             ["TXT"                   , "this.args=[$1];"]
            ,["ARGS TXT"              , "this.args.push ($2);"]
        ]
    }};

    this.id        = controller.svc;
    this.uid       = "//" + controller.svcopts.adapter + "/" + controller.svc + ":" +  controller.svcopts.port;;
    this.control   = "tcpsock";
    this.info      = "Telnet";
    this.debug     = controller.svcopts.debug;  // inherit debug from controller
    this.Debug     (1,"uid=%s", this.uid);
    this.controller= controller;  // keep a link to device controller and TCP socket
    this.parser    = new Jison(grammar);
    this.request   = 0; // job request number for gateway queue
    try {
        this.prompt= controller.gateway.opts.name +"> ";
    } catch (err) {
        this.prompt= "GatewayTracker> ";
    }
};
github Qiskit / qiskit-js / packages / qiskit-qasm / lib / Parser.js View on Github external
constructor(opts = {}) {
    dbg('Starting', opts);
    parser = new jison.Parser(bnf);

    if (opts.core !== false) {
      // TODO: Parse all core libraries (when we have more)
      const qelib1 = fs.readFileSync(
        path.resolve(__dirname, '../core/qelib1.inc'),
        'utf8',
      );
      this.qelibParsed = parser.parse(qelib1);
    }
  }
github zaach / ebnf-parser / tests / ebnf.js View on Github external
return function() {
        var grammar = {
            "lex": {
                "rules": [
                    ["\\s+", ''],
                    ["[A-Za-z]+", "return 'word';"],
                    [",", "return ',';"],
                    ["$", "return 'EOF';"]
                ]
            },
            "start": "top",
            "bnf": ebnf.transform({"top": [top]})
        };
        assert.deepEqual(grammar['bnf'], obj);
        assert.ok(new Parser(grammar).parse(str));
    };
}
github Bahmni / openmrs-module-bahmniapps / clinical-ui / node_modules / testacular / node_modules / LiveScript / lib / grammar.js View on Github external
for (name in ref$ = bnf) {
    alts = ref$[name];
    for (i$ = 0, len$ = (ref1$ = alts).length; i$ < len$; ++i$) {
      alt = ref1$[i$];
      for (j$ = 0, len1$ = (ref2$ = alt[0]).length; j$ < len1$; ++j$) {
        token = ref2$[j$];
        if (!(token in bnf)) {
          results$.push(token);
        }
      }
    }
  }
  return results$;
}()).join(' ');
bnf.Root = [[['Body'], 'return $$']];
module.exports = new (require('jison')).Parser({
  bnf: bnf,
  operators: operators,
  tokens: tokens,
  startSymbol: 'Root'
});
github tmarrs / presentations / HTML5 / 2015 / JSON-at-Work-Search-and-Transform / examples / search / api-test / node_modules / jsonpath / lib / parser.js View on Github external
var Parser = function() {

  var parser = new JisonParser(grammar);

  parser.yy.ast = _ast;
  _ast.initialize();

  return parser;

};

jison

A parser generator with Bison's API

MIT
Latest version published 7 years ago

Package Health Score

34 / 100
Full package analysis

Popular jison functions