Skip to content

Error with OPTION in enum #705

@yagop

Description

@yagop

protobuf.js version: 6.6.5

Back in v5 I was able to use OPTION in an enum, upgrading to 6.6.5 it fails.

const protobuf = require("protobufjs");

const proto = `
package main;

enum myEnum {
 OPTION = 1;
}`;

const root = protobuf.parse(proto);
/tmp/tmp.4GW7nfOYst/node_modules/protobufjs/src/parse.js:492
            throw illegal(name, "name");
            ^

Error: illegal name '=' (line 5)
    at illegal (/tmp/tmp.4GW7nfOYst/node_modules/protobufjs/src/parse.js:101:16)
    at parseOption (/tmp/tmp.4GW7nfOYst/node_modules/protobufjs/src/parse.js:492:19)
    at parseEnum (/tmp/tmp.4GW7nfOYst/node_modules/protobufjs/src/parse.js:459:21)
    at parseCommon (/tmp/tmp.4GW7nfOYst/node_modules/protobufjs/src/parse.js:251:17)
    at Object.parse (/tmp/tmp.4GW7nfOYst/node_modules/protobufjs/src/parse.js:693:21)
    at Object.<anonymous> (/tmp/tmp.4GW7nfOYst/index.js:10:23)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions