Skip to content

Commit

Permalink
Work on Language.GLSL.Parser and improvement on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
decioferreira committed Sep 18, 2024
1 parent b449973 commit 9c3c0ad
Show file tree
Hide file tree
Showing 3 changed files with 991 additions and 616 deletions.
55 changes: 27 additions & 28 deletions compiler/src/Parse/Shader.elm
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
module Parse.Shader exposing (shader)

-- import Language.GLSL.Parser as GLP

import AST.Source as Src
import AST.Utils.Shader as Shader
import Data.Map as Dict
import Data.Name as Name
import Language.GLSL.Parser as GLP
import Language.GLSL.Syntax as GLS
import Parse.Primitives as P exposing (Col, Parser, Row)
import Reporting.Annotation as A
Expand Down Expand Up @@ -118,31 +116,32 @@ eatShader src pos end row col =

parseGlsl : Row -> Col -> String -> Parser E.Expr Shader.Types
parseGlsl startRow startCol src =
-- case GLP.parse src of
-- Ok (GLS.TranslationUnit decls) ->
-- P.succeed (List.foldr addInput emptyTypes (List.concatMap extractInputs decls))
-- Err err ->
-- let
-- pos =
-- Parsec.errorPos err
-- row =
-- fromIntegral (Parsec.sourceLine pos)
-- col =
-- fromIntegral (Parsec.sourceColumn pos)
-- msg =
-- Parsec.showErrorMessages
-- "or"
-- "unknown parse error"
-- "expecting"
-- "unexpected"
-- "end of input"
-- (Parsec.errorMessages err)
-- in
-- if row == 1 then
-- failure startRow (startCol + 6 + col) msg
-- else
-- failure (startRow + row - 1) col msg
Debug.todo "parseGlsl"
case GLP.parse src of
Ok (GLS.TranslationUnit decls) ->
P.pure (List.foldr addInput emptyTypes (List.concatMap extractInputs decls))

Err err ->
-- let
-- pos =
-- Parsec.errorPos err
-- row =
-- fromIntegral (Parsec.sourceLine pos)
-- col =
-- fromIntegral (Parsec.sourceColumn pos)
-- msg =
-- Parsec.showErrorMessages
-- "or"
-- "unknown parse error"
-- "expecting"
-- "unexpected"
-- "end of input"
-- (Parsec.errorMessages err)
-- in
-- if row == 1 then
-- failure startRow (startCol + 6 + col) msg
-- else
-- failure (startRow + row - 1) col msg
Debug.todo "parseGlsl"


failure : Row -> Col -> String -> Parser E.Expr a
Expand Down
Loading

0 comments on commit 9c3c0ad

Please sign in to comment.