-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 524c06f
Showing
13 changed files
with
5,075 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests for the configured nvm version of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: "npm" | ||
- run: npm ci | ||
- run: npm run elm-format:validate | ||
- run: npm test | ||
- run: npm run elm-review |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
elm-stuff | ||
node_modules |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v22.8.0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Copyright 2024 Décio Ferreira | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Elm GLSL Parser | ||
|
||
An Elm package that implements a GLSL (OpenGL Shading Language) parser, inspired by the [Haskell GLSL parser](https://hackage.haskell.org/package/language-glsl). This library allows you to parse GLSL shader code into Elm data structures, enabling further manipulation, analysis, or code generation. | ||
|
||
## Getting Started | ||
|
||
### Installation | ||
|
||
To install the package, run the following: | ||
|
||
```bash | ||
elm install guida-lang/glsl | ||
``` | ||
|
||
### Usage | ||
|
||
Here’s an example of how to use the GLSL parser in Elm: | ||
|
||
```elm | ||
import Language.GLSL.Parser as Parser | ||
import Language.GLSL.Syntax as Syntax | ||
|
||
shaderSource : String | ||
shaderSource = | ||
""" | ||
void main() { | ||
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); | ||
} | ||
""" | ||
|
||
parseResult : Result String Syntax.TranslationUnit | ||
parseResult = | ||
Parser.parse shaderSource | ||
``` | ||
|
||
### Parsing GLSL | ||
|
||
The `parse` function attempts to parse a GLSL shader string and returns a `Result`: | ||
|
||
- `Ok Syntax.TranslationUnit`: If the shader was parsed successfully, it returns an abstract syntax | ||
tree (AST) representing the GLSL code. | ||
- `Err String`: If parsing failed, it returns an error string describing the issue. | ||
|
||
### Example | ||
|
||
```elm | ||
case parseResult of | ||
Ok shader -> | ||
-- Do something with the parsed shader | ||
Debug.log "Parsed successfully!" shader | ||
|
||
Err error -> | ||
Debug.log "Failed to parse shader:" error | ||
``` | ||
|
||
## Documentation | ||
|
||
For full API documentation and more examples, please visit the | ||
[Elm package documentation](https://package.elm-lang.org/packages/guida-lang/glsl/1.0.0). | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! If you have ideas for improvements or find bugs, feel free to open an | ||
issue or submit a pull request. | ||
|
||
### To contribute: | ||
|
||
1. Fork the repository. | ||
2. Create a new feature branch. | ||
3. Commit your changes. | ||
4. Submit a pull request. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"type": "package", | ||
"name": "guida-lang/glsl", | ||
"summary": "An Elm parser for GLSL, inspired by Haskell's GLSL parser", | ||
"license": "BSD-3-Clause", | ||
"version": "1.0.0", | ||
"exposed-modules": [ | ||
"Language.GLSL.Parser", | ||
"Language.GLSL.Syntax" | ||
], | ||
"elm-version": "0.19.0 <= v < 0.20.0", | ||
"dependencies": { | ||
"andre-dietrich/parser-combinators": "4.1.0 <= v < 5.0.0", | ||
"elm/core": "1.0.0 <= v < 2.0.0", | ||
"pilatch/flip": "1.0.0 <= v < 2.0.0", | ||
"rtfeldman/elm-hex": "1.0.0 <= v < 2.0.0" | ||
}, | ||
"test-dependencies": { | ||
"elm-explorations/test": "2.2.0 <= v < 3.0.0" | ||
} | ||
} |
Oops, something went wrong.