Skip to main content
Commonmark migration
Source Link

###scala 579:

scala 579:

import scala.util.parsing.combinator._ object M extends JavaTokenParsers{def i=ident type P=Parser[Any] def r:P=n~"("~rep(p)~")"~opt("throws"~rep(t))^^(s=>"\n/**\n $"+s._1._1._2.mkString("")+s._1._1._1+"\n2:"+(s._2.getOrElse(""))+"\n*/") def n:P=i~i^^(s=>if(s._1=="void")""else"\nreturn $") def p:P=i~i~opt(",")^^(s=>("\n@param "+s._1._2+" $")) def t:P=i~opt(",")^^(s=>("\n@throws "+s._1+" $")) def main (args:Array[String])={val i=parseAll(r,readLine()) println(i.toString().replaceAll(".:.*","").replaceAll("[~(),]","").replaceAll("^[\\[].*","").replaceAll ("\n\n","\n"))}} 

I'm sorry, I'm not experienced with TokenParsers. I guess I'm doing it wrong, and there is much room for improvement.

###scala 579:

import scala.util.parsing.combinator._ object M extends JavaTokenParsers{def i=ident type P=Parser[Any] def r:P=n~"("~rep(p)~")"~opt("throws"~rep(t))^^(s=>"\n/**\n $"+s._1._1._2.mkString("")+s._1._1._1+"\n2:"+(s._2.getOrElse(""))+"\n*/") def n:P=i~i^^(s=>if(s._1=="void")""else"\nreturn $") def p:P=i~i~opt(",")^^(s=>("\n@param "+s._1._2+" $")) def t:P=i~opt(",")^^(s=>("\n@throws "+s._1+" $")) def main (args:Array[String])={val i=parseAll(r,readLine()) println(i.toString().replaceAll(".:.*","").replaceAll("[~(),]","").replaceAll("^[\\[].*","").replaceAll ("\n\n","\n"))}} 

I'm sorry, I'm not experienced with TokenParsers. I guess I'm doing it wrong, and there is much room for improvement.

scala 579:

import scala.util.parsing.combinator._ object M extends JavaTokenParsers{def i=ident type P=Parser[Any] def r:P=n~"("~rep(p)~")"~opt("throws"~rep(t))^^(s=>"\n/**\n $"+s._1._1._2.mkString("")+s._1._1._1+"\n2:"+(s._2.getOrElse(""))+"\n*/") def n:P=i~i^^(s=>if(s._1=="void")""else"\nreturn $") def p:P=i~i~opt(",")^^(s=>("\n@param "+s._1._2+" $")) def t:P=i~opt(",")^^(s=>("\n@throws "+s._1+" $")) def main (args:Array[String])={val i=parseAll(r,readLine()) println(i.toString().replaceAll(".:.*","").replaceAll("[~(),]","").replaceAll("^[\\[].*","").replaceAll ("\n\n","\n"))}} 

I'm sorry, I'm not experienced with TokenParsers. I guess I'm doing it wrong, and there is much room for improvement.

Source Link
user unknown
  • 4.6k
  • 32
  • 32

###scala 579:

import scala.util.parsing.combinator._ object M extends JavaTokenParsers{def i=ident type P=Parser[Any] def r:P=n~"("~rep(p)~")"~opt("throws"~rep(t))^^(s=>"\n/**\n $"+s._1._1._2.mkString("")+s._1._1._1+"\n2:"+(s._2.getOrElse(""))+"\n*/") def n:P=i~i^^(s=>if(s._1=="void")""else"\nreturn $") def p:P=i~i~opt(",")^^(s=>("\n@param "+s._1._2+" $")) def t:P=i~opt(",")^^(s=>("\n@throws "+s._1+" $")) def main (args:Array[String])={val i=parseAll(r,readLine()) println(i.toString().replaceAll(".:.*","").replaceAll("[~(),]","").replaceAll("^[\\[].*","").replaceAll ("\n\n","\n"))}} 

I'm sorry, I'm not experienced with TokenParsers. I guess I'm doing it wrong, and there is much room for improvement.