This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.testcode; | |
import com.github.javaparser.JavaParser; | |
import com.github.javaparser.Position; | |
import com.github.javaparser.ast.CompilationUnit; | |
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; | |
import com.github.javaparser.ast.body.MethodDeclaration; | |
import com.github.javaparser.ast.expr.MethodCallExpr; | |
import com.github.javaparser.ast.nodeTypes.NodeWithRange; | |
import com.github.javaparser.ast.stmt.CatchClause; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
import java.util.stream.Stream; | |
public class Main3 { | |
public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.xml; | |
import org.joox.Match; | |
import org.w3c.dom.DOMImplementation; | |
import org.w3c.dom.Document; | |
import org.w3c.dom.DocumentType; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.transform.OutputKeys; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.xml; | |
import org.joox.Match; | |
import org.w3c.dom.DOMImplementation; | |
import org.w3c.dom.Document; | |
import org.w3c.dom.DocumentType; | |
import org.w3c.dom.Element; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE | |
DuplicateRecordFields | |
, OverloadedLabels | |
, DataKinds | |
, TypeFamilies | |
, FlexibleInstances | |
, MultiParamTypeClasses | |
#-} | |
import GHC.OverloadedLabels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Applicative | |
import Data.Attoparsec.ByteString.Char8 | |
import qualified Data.Attoparsec.Internal.Types as T | |
-- | an equivalence of regrex {min, max} | |
-- see http://d.hatena.ne.jp/kazu-yamamoto/20100104/1262588929 | |
range :: Int -> Int -> T.Parser i a -> T.Parser i [a] | |
range n m p = (++) | |
<$> count n p -- mimimam | |
<*> upto (m - n) p -- rest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:set -XOverloadedStrings | |
import Control.Applicative | |
import Data.Attoparsec.Text | |
import Data.Attoparsec.Combinator | |
let foo = manyTill anyChar (lookAhead $ (char '@')) | |
parseOnly (many foo) "@" | |
^CInterrupted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Test06 where | |
import Prelude hiding (readFile, lookup) | |
import Control.Monad.IO.Class | |
import Control.Lens | |
import Data.Aeson | |
import Data.Aeson.Lens |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.State | |
import Data.Void | |
import Text.Megaparsec hiding (State) | |
import Text.Megaparsec.Char | |
import qualified Text.Megaparsec.Char.Lexer as L | |
type Parser = ParsecT Void String (State Int) | |
str :: String | |
str = "11,2,43" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Test01 where | |
import Text.Parse | |
import qualified Text.ParserCombinators.Poly.State as PS | |
main :: IO () | |
main = putStrLn "Test01" | |
liftP :: Parser t a -> PS.Parser s t a | |
liftP (P func) = PS.P $ \s tx -> pareResult s (func tx) |