Advertisement
tudzic

Untitled

Oct 29th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. def abstractmethod : Parser[List[MethodAbstractDecl]] = ("abstract" ~> typebkool) ~ identifier ~( "(" ~> opt(listofpara)<~")"~";") ^^ {
  2. case a~b~Some(c) =>List(MethodAbstractDecl(a,b,c))
  3. case a~b~ None => List(MethodAbstractDecl(a,b,List()))
  4. }
  5. def method : Parser[List[MethodImpDecl]] = methodreturn|methodnonreturn
  6.  
  7. def methodreturn :Parser[List[MethodImpDecl]] =typebkool ~ identifier~( "(" ~> opt(listofpara)<~")") ~ blockstat ^^
  8. {
  9. case a~b~Some(c)~d => List(MethodImpDecl(a,b,c,d))
  10. case a~b~None~d=> List(MethodImpDecl(a,b,List(),d))
  11. }
  12.  
  13. def methodnonreturn :Parser[List[MethodImpDecl]] =identifier~ ("(" ~> opt(listofpara)<~")") ~ blockstat ^^
  14. {
  15. case a~Some(b)~c => List(MethodImpDecl(null,a,b,c))
  16. case a~None~c => List(MethodImpDecl(null,a,List(),c))
  17. }
  18.  
  19. def listofpara : Parser[List[ParamDecl]]= rep1sep(para,";") ^^
  20. {
  21. case dl => dl.foldLeft(List[ParamDecl]())((a,b) => a++b )
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement