packages feed

nmis-parser 0.1.0.0 → 0.1.0.1

raw patch · 9 files changed

+43/−123 lines, 9 filesdep ~megaparsecbinary-added

Dependency ranges changed: megaparsec

Files

− .DS_Store

binary file changed (6148 → absent bytes)

− ._.DS_Store

binary file changed (120 → absent bytes)

LICENSE view
@@ -1,4 +1,4 @@-Copyright Author name here (c) 2017+Copyright Sasa Bogicevic (c) 2017  All rights reserved. 
nmis-parser.cabal view
@@ -1,5 +1,5 @@ name:                nmis-parser-version:             0.1.0.0+version:             0.1.0.1 synopsis:            NMIS file parser homepage:            https://github.com/v0d1ch/nmis-parser#readme license:             BSD3@@ -22,7 +22,7 @@                      , Text.Internal.NmisTypes   build-depends:       base >= 4.7 && < 5                      , containers-                     , megaparsec+                     , megaparsec < 5.3.2   default-language:    Haskell2010  
+ nmis-parser.cabal~ view
@@ -0,0 +1,40 @@+name:                nmis-parser+version:             0.1.0.0+synopsis:            NMIS file parser+homepage:            https://github.com/v0d1ch/nmis-parser#readme+license:             BSD3+license-file:        LICENSE+author:              Sasa Bogicevic+maintainer:          brutallesale@gmail.com+copyright:           2017 Sasa Bogicevic+category:            Text, Parsers+build-type:          Simple+extra-source-files:  README.md+cabal-version:       >=1.10++description:+     Parser for __NMIS__ (Network Management Information System) files to record type. Main module to use is __Text.Nmis__ and __parseNmis__ function++library+  hs-source-dirs:      src+  exposed-modules:     Text.Nmis+                     , Text.Internal.Helper+                     , Text.Internal.NmisTypes+  build-depends:       base >= 4.7 && < 5+                     , containers+                     , megaparsec < 5.3.2+  default-language:    Haskell2010+++test-suite nmis-test+  type:                exitcode-stdio-1.0+  hs-source-dirs:      test+  main-is:             Spec.hs+  build-depends:       base+                     , Nmis+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N+  default-language:    Haskell2010++source-repository head+  type:     git+  location: https://github.com/v0d1ch/nmis-parser
+ src/Text/Internal/.DS_Store view

binary file changed (absent → 6148 bytes)

+ src/Text/Internal/._.DS_Store view

binary file changed (absent → 120 bytes)

− src/Text/Internal/Helper.hs~
@@ -1,84 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--- | This helper module contains functions to parse nmis file.--- It uses megapasec library-module Helper where--import Control.Applicative (empty)-import Control.Monad (void)-import Prelude hiding (until)-import Text.Megaparsec-import qualified Text.Megaparsec.Lexer as L-import Text.Megaparsec.String---- | space consumer - consume space and comments-spaceConsumer :: Parser ()-spaceConsumer = L.space (void spaceChar) lineCmnt blockCmnt-  where-    lineCmnt = L.skipLineComment "#"-    blockCmnt = L.skipBlockComment "/*" "*/"--- | hashbang line comment-lineComment :: Parser ()-lineComment = L.skipLineComment "#"---- | space consumer no 2-scn :: Parser ()-scn = L.space (void spaceChar) lineComment empty---- | lexeme-lexeme :: Parser a -> Parser a-lexeme = L.lexeme spaceConsumer---- | symbol-symbol :: String -> Parser String-symbol = L.symbol scn---- | arrow - parse haskell constraint like arrow sign-parrow :: Parser String-parrow = lexeme $ string " => "---- | equals - parse equals sign-pequals :: Parser String-pequals = lexeme $ string " = "---- | parse all between parens-parens :: Parser a -> Parser a-parens = between (string "(") (string ")")---- | parse all between braces-braces :: Parser a -> Parser a-braces = between (string "{") (string "}")---- | parse until string passed as function parameter-until :: String -> Parsec Dec String String-until s = anyChar `manyTill` string s---- | parse until newline character-untilEol :: Parsec Dec String String-untilEol = anyChar `someTill` newline---- | parse until newline character-phash :: Parser String-phash = lexeme $ string' "%hash" >> pequals---- | parse quoted string with optional space in front of it-pQuotedStr :: Parser String-pQuotedStr = do-  _ <- optional space-  string' "'" >> until "'"---- | parse 'undef' literal-pUndefined :: Parser String-pUndefined = do-  _ <- optional space-  string' "undef"---- | combined parser for single record-pOpt :: Parser (String, String)-pOpt = do-  _ <- space-  key <- pQuotedStr-  _ <- space >> string "=>" >> space-  value <- try (pQuotedStr <|> pUndefined <|> many numberChar)-  _ <- optional $ string' ","-  _ <- newline-  return (key, value)
− src/Text/Internal/NmisTypes.hs~
@@ -1,36 +0,0 @@-module NmisTypes where---- | Main type that containes all parsed data-data Nmis = Nmis-  { customer :: Maybe String-  , groups :: Maybe String-  , active :: Maybe String-  , advancedOptions :: Maybe String-  , authKey :: Maybe String-  , authPassword :: Maybe String-  , authProtocol :: Maybe String-  , businessService :: Maybe String-  , calls :: Maybe String-  , cbqos :: Maybe String-  , collect :: Maybe String-  , community :: Maybe String-  , depend :: Maybe String-  , display_name :: Maybe String-  , group :: Maybe String-  , host :: Maybe String-  , location :: Maybe String-  , model :: Maybe String-  , name :: Maybe String-  , netType :: Maybe String-  , ping :: Maybe String-  , port :: Maybe String-  , rancid :: Maybe String-  , roleType :: Maybe String-  , serviceStatus :: Maybe String-  , services :: Maybe String-  , threshold :: Maybe String-  , timezone :: Maybe Integer-  , uuid :: Maybe String-  , version :: Maybe String-  , webserver :: Maybe String-  } deriving (Show)