twitter / scrooge

A Thrift parser/generator
http://twitter.github.io/scrooge/
Apache License 2.0
793 stars 247 forks source link

FileParseException if "//" style comment occurs in windows platform #255

Open xieliang opened 7 years ago

xieliang commented 7 years ago

see https://issues.apache.org/jira/browse/DL-28

[ERROR] Exception parsing: E:\incubator-distributedlog\distributedlog-protocol\src\main\thrift\service.thrift: [3.1] failure: string matching regex \z' expected but/' found [ERROR] [ERROR] // Response stats codes [ERROR] [ERROR] ^ [ERROR] -> [Help 1] com.twitter.scrooge.frontend.FileParseException: Exception parsing: E:\isoftstone\workspacedeis\incubator-distributedlog\distributedlog-protocol\src\main\thrift\service.thrift at com.twitter.scrooge.frontend.ThriftParser$$anonfun$parse$1.apply(ThriftParser.scala:427) at com.twitter.scrooge.frontend.ThriftParser$$anonfun$parse$1.apply(ThriftParser.scala:427) at scala.Option.map(Option.scala:145) at com.twitter.scrooge.frontend.ThriftParser.parse(ThriftParser.scala:420) at com.twitter.scrooge.frontend.ThriftParser.parseFile(ThriftParser.scala:448) at com.twitter.scrooge.Compiler$$anonfun$run$2.apply(Compiler.scala:66) at com.twitter.scrooge.Compiler$$anonfun$run$2.apply(Compiler.scala:64) at scala.collection.immutable.List.foreach(List.scala:318) at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32) at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45) at com.twitter.scrooge.Compiler.run(Compiler.scala:64) at com.twitter.ScroogeRunner.compile(ScroogeRunner.scala:45) at com.twitter.AbstractMavenScroogeMojo.execute(AbstractMavenScroogeMojo.java:239) at com.twitter.MavenScroogeCompileMojo.execute(MavenScroogeCompileMojo.java:22) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216) at org.apache.maven.cli.MavenCli.main(MavenCli.java:160) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: com.twitter.scrooge.frontend.ParseException: [3.1] failure: string matching regex \z' expected but/' found // Response stats codes ^ at com.twitter.scrooge.frontend.ThriftParser.parse(ThriftParser.scala:423)

kevinoliver commented 7 years ago

@xieliang our team lacks a windows environment so it'll be hard for us to reproduce, let alone fix.

mosesn commented 7 years ago

@xieliang do you mind taking a stab at fixing this?