Skip to content

Commit

Permalink
Add LALRPOP
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed May 5, 2024
1 parent 364912f commit 4c87009
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 21 deletions.
1 change: 1 addition & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Just (justfile)
K (k)
Korn Shell (ksh,.kshrc)
Kotlin (kt,kts)
LALRPOP (lalrpop)
LaTeX (tex)
LD Script (lds)
Lean (lean,hlean)
Expand Down
38 changes: 19 additions & 19 deletions SCC-OUTPUT-REPORT.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<th>453</th>
<th>7424</th>
<th>1516</th>
<th>395673</th>
<th>396673</th>
<th>3929</th>
</tr><tr>
<td>processor/workers_test.go</td>
Expand Down Expand Up @@ -250,16 +250,6 @@
<td>0</td>
<td>2222</td>
<td>35</td>
</tr><tr>
<td>processor/cocomo_test.go</td>
<td></td>
<td>37</td>
<td>8</td>
<td>4</td>
<td>25</td>
<td>6</td>
<td>699</td>
<td>23</td>
</tr><tr>
<td>processor/bloom.go</td>
<td></td>
Expand All @@ -271,15 +261,15 @@
<td>1051</td>
<td>29</td>
</tr><tr>
<td>processor/structs_test.go</td>
<td>processor/cocomo_test.go</td>
<td></td>
<td>32</td>
<td>37</td>
<td>8</td>
<td>1</td>
<td>23</td>
<td>4</td>
<td>517</td>
<td>19</td>
<td>25</td>
<td>6</td>
<td>699</td>
<td>23</td>
</tr><tr>
<td>processor/helpers.go</td>
<td></td>
Expand All @@ -290,6 +280,16 @@
<td>2</td>
<td>544</td>
<td>21</td>
</tr><tr>
<td>processor/structs_test.go</td>
<td></td>
<td>32</td>
<td>8</td>
<td>1</td>
<td>23</td>
<td>4</td>
<td>517</td>
<td>19</td>
</tr><tr>
<td>processor/processor_unix_test.go</td>
<td></td>
Expand Down Expand Up @@ -318,7 +318,7 @@
<td>0</td>
<td>4</td>
<td>0</td>
<td>169185</td>
<td>170185</td>
<td>5</td>
</tr></tbody>
<tfoot><tr>
Expand All @@ -329,7 +329,7 @@
<th>453</th>
<th>7424</th>
<th>1516</th>
<th>395673</th>
<th>396673</th>
<th>3929</th>
</tr>
<tr>
Expand Down
36 changes: 36 additions & 0 deletions examples/language/lalrpop.lalrpop
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 37 lines 26 code 3 comments 8 blanks
use crate::ast::{ExprSymbol, Opcode};
use crate::tok9::Tok;

grammar<'input>(input: &'input str);

// line comment
pub Expr: Box<ExprSymbol<'input>> = { // comment 1
Expr r##"verbatim2"## Factor => Box::new(ExprSymbol::Op(<>)),
Factor, // comment 2
};

Factor: Box<ExprSymbol<'input>> = { // comment 3
Factor "FactorOp" Term => Box::new(ExprSymbol::Op(<>)),
Term,
};

// comment 4

Term: Box<ExprSymbol<'input>> = {
r#"verbatim"# => Box::new(ExprSymbol::NumSymbol(<>)),
"(" <Expr> ")"
};

extern {
type Location = usize;
type Error = ();

enum Tok<'input> {
r#"verbatim"# => Tok::NumSymbol(<&'input str>),
"FactorOp" => Tok::FactorOp(<Opcode>),
r##"verbatim2"## => Tok::ExprOp(<Opcode>),
"(" => Tok::ParenOpen,
")" => Tok::ParenClose,
}
}
51 changes: 51 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6573,6 +6573,57 @@
}
]
},
"LALRPOP": {
"complexitychecks": [
"for ",
"for(",
"if ",
"if(",
"switch ",
"while ",
"else ",
"|| ",
"&& ",
"!= ",
"== ",
"match "
],
"extensions": [
"lalrpop"
],
"line_comment": [
"//"
],
"multi_line": [
[
"/*",
"*/"
]
],
"nestedmultiline": true,
"quotes": [
{
"end": "\"",
"start": "\""
},
{
"end": "\\\"",
"start": "\\\""
},
{
"end": "#\\\"",
"start": "\\\"#"
},
{
"end": "r##\\\"",
"start": "\\\"##"
},
{
"end": "r#\\\"",
"start": "\\\"#"
}
]
},
"SAS": {
"complexitychecks": [
"do",
Expand Down
2 changes: 1 addition & 1 deletion processor/constants.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ else
fi

# Try out specific languages
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI ' 'Hare ' 'Templ ' 'Cuda ' 'GraphQL ' 'Bicep ' 'Pkl ' 'TypeSpec '
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI ' 'Hare ' 'Templ ' 'Cuda ' 'GraphQL ' 'Bicep ' 'Pkl ' 'TypeSpec ' 'LALRPOP '
do
if ./scc "examples/language/" | grep -q "$i "; then
echo -e "${GREEN}PASSED $i Language Check"
Expand Down

0 comments on commit 4c87009

Please sign in to comment.