Coder Social home page Coder Social logo

qwefgh90 / comment-parser Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 60 KB

The Comment Parser supports various languages based on FSM. It's written by scala and java.

License: Apache License 2.0

Scala 61.48% Java 12.39% Batchfile 1.96% C 13.04% Go 0.71% HTML 4.32% JavaScript 1.60% Python 2.18% Ruby 0.42% Shell 1.91%
comment-parser language sbt scala java parser comment parsing

comment-parser's Introduction

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:

<dependency>
    <groupId>io.github.qwefgh90</groupId>
    <artifactId>comment-parser_2.11</artifactId>
    <version>0.1.0</version>
</dependency>

or

<dependency>
    <groupId>io.github.qwefgh90</groupId>
    <artifactId>comment-parser_2.11</artifactId>
    <version>0.1.0</version>
</dependency>

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.

import io.github.qwefgh90.commentparser.CommentParser;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.List;
Optional<java.util.List<CommentParser.CommentResult>> result = CommentParser.extractComments(Paths.get("C:\\java.java").toUri(), "java.java");

InputStream object can be used to first parameter.

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<java.util.List<CommentParser.CommentResult>> result = CommentParser.extractComments(is, "java.java");
is.close();

You can pass Charset object to third parameter optionally.

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<java.util.List<CommentParser.CommentResult>> result = CommentParser.extractComments(Paths.get("C:\\java.java").toUri(), "java.java", StandardCharsets.UTF_8);

For more information, You can check API document.

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

comment-parser's People

Contributors

brokenjpl avatar qwefgh90 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

brokenjpl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.