Skip to content

Error: illegal token '*/' #1237

@lili21

Description

@lili21

protobuf.js version: <6.8.8>

const protobuf = require('protobufjs')
const root = new protobuf.Root()
root.load('./test.proto', { alternateCommentMode: true }, (err, root) => {
  if (err) {
    throw err
  } else {
    console.log('success')
  }
})
Error: illegal token '*/' (/Users/li.li/just-do-it/try-pb-schema/test.proto, line 9)
    at illegal (/Users/li.li/just-do-it/try-pb-schema/node_modules/protobufjs/src/parse.js:94:16)
    at parse (/Users/li.li/just-do-it/try-pb-schema/node_modules/protobufjs/src/parse.js:734:23)
    at process (/Users/li.li/just-do-it/try-pb-schema/node_modules/protobufjs/src/root.js:107:30)
    at /Users/li.li/just-do-it/try-pb-schema/node_modules/protobufjs/src/root.js:182:17
    at fetchReadFileCallback (/Users/li.li/just-do-it/try-pb-schema/node_modules/@protobufjs/fetch/index.js:51:19)
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:54:3)

test.proto

syntax = "proto3";

message MyMessage {
  string name = 1;
  int32 age = 2;
}

// lklklklk
/*lilili
*/

It can't handle /*...*/ comment under // comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions