Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qwefgh90/comment-parser
The Comment Parser supports various languages based on FSM. It's written by scala and java.
https://github.com/qwefgh90/comment-parser
comment comment-parser java language parser parsing sbt scala
Last synced: 7 days ago
JSON representation
The Comment Parser supports various languages based on FSM. It's written by scala and java.
- Host: GitHub
- URL: https://github.com/qwefgh90/comment-parser
- Owner: qwefgh90
- License: apache-2.0
- Created: 2017-11-17T08:15:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-01T08:20:08.000Z (almost 5 years ago)
- Last Synced: 2024-06-21T16:57:28.909Z (5 months ago)
- Topics: comment, comment-parser, java, language, parser, parsing, sbt, scala
- Language: Scala
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Comment Parser
The Comment Parser supports various languages based on FSM. It's written by scala and java.## Prerequisites
- Java 1.8
## Getting comment parser
Comment Parser is published to Sonatype OSS and Maven Central:
- Group id / organization: *io.github.qwefgh90*
- Artifact id / name: *comment-parser*
- Latest version is *0.1.0*Add it to your sbt build definition:
```
libraryDependencies += "io.github.qwefgh90" %% "comment-parser" % "0.1.0"
```Add one of them to your maven pom file:
```io.github.qwefgh90
comment-parser_2.11
0.1.0```
or
```
io.github.qwefgh90
comment-parser_2.11
0.1.0```
## Using Comment Parser
CommentParser is a main class to extract comments from various files. Import ` io.github.qwefgh90.commentparser` package to your sources to use CommentParser. Also, there is a inner `CommentParser.CommentResult` class containing a result.
It has four static methods to do that.
You can pass `URI` object to first parameter.
```java
import io.github.qwefgh90.commentparser.CommentParser;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.List;
Optional> result = CommentParser.extractComments(Paths.get("C:\\java.java").toUri(), "java.java");
````InputStream` object can be used to first parameter.
```java
import io.github.qwefgh90.commentparser.CommentParser;
import java.nio.file.Paths;
import java.io.InputStream;
import java.io.File;
import java.util.Optional;
import java.util.List;
File f = Paths.get("C:\\java.java").toFile();
InputStream is = new FileInputStream(f);
Optional> result = CommentParser.extractComments(is, "java.java");
is.close();
```You can pass `Charset` object to third parameter optionally.
```java
import io.github.qwefgh90.commentparser.CommentParser;
import java.nio.file.Paths;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.List;
Optional> result = CommentParser.extractComments(Paths.get("C:\\java.java").toUri(), "java.java", StandardCharsets.UTF_8);
```For more information, [You can check API document.](https://qwefgh90.github.io/comment-parser/)
## Supported Languages
- JAVA
- PY
- C
- CPP
- C_HEADER
- CPP_HEADER
- SCALA
- RUBY
- GO
- JS
- HTML
- BAT
- SH
- XML
- TEXT
- MD
- ETC## Compile & Test
- sbt compile
- sbt test