{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}

module BNFC.Backend.C where

import BNFC.CF
import BNFC.Prelude

import BNFC.Options.GlobalOptions
import BNFC.Options.Target

import BNFC.Backend.CommonInterface.Backend

import Control.Monad.Except
import Control.Monad.State

import Options.Applicative

instance Backend 'TargetC where
  type BackendOptions 'TargetC = CBackendOptions
  type BackendState 'TargetC = CBackendState
  parseOpts :: Parser CBackendOptions
  parseOpts :: Parser CBackendOptions
parseOpts = Parser CBackendOptions
forall a. HasCallStack => a
undefined
  initState  :: LBNF -> GlobalOptions -> BackendOptions 'TargetC -> Except String (BackendState 'TargetC)
  initState :: LBNF
-> GlobalOptions
-> BackendOptions 'TargetC
-> Except String (BackendState 'TargetC)
initState = LBNF
-> GlobalOptions
-> BackendOptions 'TargetC
-> Except String (BackendState 'TargetC)
forall a. HasCallStack => a
undefined
  abstractSyntax :: LBNF -> State (BackendState 'TargetC) Result
  abstractSyntax :: LBNF -> State (BackendState 'TargetC) Result
abstractSyntax = LBNF -> State (BackendState 'TargetC) Result
forall a. HasCallStack => a
undefined
  printer :: LBNF -> State (BackendState 'TargetC) Result
  printer :: LBNF -> State (BackendState 'TargetC) Result
printer = LBNF -> State (BackendState 'TargetC) Result
forall a. HasCallStack => a
undefined
  lexer :: LBNF -> State (BackendState 'TargetC) Result
  lexer :: LBNF -> State (BackendState 'TargetC) Result
lexer = LBNF -> State (BackendState 'TargetC) Result
forall a. HasCallStack => a
undefined
  parser :: LBNF -> State (BackendState 'TargetC) Result
  parser :: LBNF -> State (BackendState 'TargetC) Result
parser = LBNF -> State (BackendState 'TargetC) Result
forall a. HasCallStack => a
undefined
  parserTest :: LBNF -> State (BackendState 'TargetC) Result
  parserTest :: LBNF -> State (BackendState 'TargetC) Result
parserTest = LBNF -> State (BackendState 'TargetC) Result
forall a. HasCallStack => a
undefined
  makefile :: LBNF -> State (BackendState 'TargetC) Result
  makefile :: LBNF -> State (BackendState 'TargetC) Result
makefile = LBNF -> State (BackendState 'TargetC) Result
forall a. HasCallStack => a
undefined

newtype CBackendOptions = COpts Bool

cOptionsParser :: Parser CBackendOptions
cOptionsParser :: Parser CBackendOptions
cOptionsParser = Bool -> CBackendOptions
COpts (Bool -> CBackendOptions) -> Parser Bool -> Parser CBackendOptions
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Bool
oLineNumbers

  where

    -- line-numbers option
    oLineNumbers :: Parser Bool
oLineNumbers =
      Mod FlagFields Bool -> Parser Bool
switch
          ( Char -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => Char -> Mod f a
short Char
'l'
         Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"line-numbers"
         Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
help String
"Add and set line_number field for all syntax classes" )

data CBackendState