Convert all CRLF line endings to LF.

This commit is contained in:
Alexis Hunt 2019-01-10 16:47:50 -05:00
parent 0c67bbed06
commit 802ac11a20
9 changed files with 1943 additions and 1943 deletions

6
.gitattributes vendored
View File

@ -1,3 +1,3 @@
* text=auto
lalrpop/src/parser/lrgrammar.lalrpop text eol=lf
* text=auto
lalrpop/src/parser/lrgrammar.lalrpop text eol=lf

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +1,157 @@
%{
/*
* scan.l
*
* lex input file for pascal scanner
*
* extensions: to ways to spell "external" and "->" ok for "^".
*/
#include <stdio.h>
#include "y.tab.h"
int line_no = 1;
%}
A [aA]
B [bB]
C [cC]
D [dD]
E [eE]
F [fF]
G [gG]
H [hH]
I [iI]
J [jJ]
K [kK]
L [lL]
M [mM]
N [nN]
O [oO]
P [pP]
Q [qQ]
R [rR]
S [sS]
T [tT]
U [uU]
V [vV]
W [wW]
X [xX]
Y [yY]
Z [zZ]
NQUOTE [^']
%%
{A}{N}{D} return(AND);
{A}{R}{R}{A}{Y} return(ARRAY);
{C}{A}{S}{E} return(CASE);
{C}{O}{N}{S}{T} return(CONST);
{D}{I}{V} return(DIV);
{D}{O} return(DO);
{D}{O}{W}{N}{T}{O} return(DOWNTO);
{E}{L}{S}{E} return(ELSE);
{E}{N}{D} return(END);
{E}{X}{T}{E}{R}{N} |
{E}{X}{T}{E}{R}{N}{A}{L} return(EXTERNAL);
{F}{O}{R} return(FOR);
{F}{O}{R}{W}{A}{R}{D} return(FORWARD);
{F}{U}{N}{C}{T}{I}{O}{N} return(FUNCTION);
{G}{O}{T}{O} return(GOTO);
{I}{F} return(IF);
{I}{N} return(IN);
{L}{A}{B}{E}{L} return(LABEL);
{M}{O}{D} return(MOD);
{N}{I}{L} return(NIL);
{N}{O}{T} return(NOT);
{O}{F} return(OF);
{O}{R} return(OR);
{O}{T}{H}{E}{R}{W}{I}{S}{E} return(OTHERWISE);
{P}{A}{C}{K}{E}{D} return(PACKED);
{B}{E}{G}{I}{N} return(PBEGIN);
{F}{I}{L}{E} return(PFILE);
{P}{R}{O}{C}{E}{D}{U}{R}{E} return(PROCEDURE);
{P}{R}{O}{G}{R}{A}{M} return(PROGRAM);
{R}{E}{C}{O}{R}{D} return(RECORD);
{R}{E}{P}{E}{A}{T} return(REPEAT);
{S}{E}{T} return(SET);
{T}{H}{E}{N} return(THEN);
{T}{O} return(TO);
{T}{Y}{P}{E} return(TYPE);
{U}{N}{T}{I}{L} return(UNTIL);
{V}{A}{R} return(VAR);
{W}{H}{I}{L}{E} return(WHILE);
{W}{I}{T}{H} return(WITH);
[a-zA-Z]([a-zA-Z0-9])+ return(IDENTIFIER);
":=" return(ASSIGNMENT);
'({NQUOTE}|'')+' return(CHARACTER_STRING);
":" return(COLON);
"," return(COMMA);
[0-9]+ return(DIGSEQ);
"." return(DOT);
".." return(DOTDOT);
"=" return(EQUAL);
">=" return(GE);
">" return(GT);
"[" return(LBRAC);
"<=" return(LE);
"(" return(LPAREN);
"<" return(LT);
"-" return(MINUS);
"<>" return(NOTEQUAL);
"+" return(PLUS);
"]" return(RBRAC);
[0-9]+"."[0-9]+ return(REALNUMBER);
")" return(RPAREN);
";" return(SEMICOLON);
"/" return(SLASH);
"*" return(STAR);
"**" return(STARSTAR);
"->" |
"^" return(UPARROW);
"(*" |
"{" { register int c;
while ((c = input()))
{
if (c == '}')
break;
else if (c == '*')
{
if ((c = input()) == ')')
break;
else
unput (c);
}
else if (c == '\n')
line_no++;
else if (c == 0)
commenteof();
}
}
[ \t\f] ;
\n line_no++;
. { fprintf (stderr,
"'%c' (0%o): illegal charcter at line %d\n",
yytext[0], yytext[0], line_no);
}
%%
commenteof()
{
fprintf (stderr, "unexpected EOF inside comment at line %d\n",
line_no);
exit (1);
}
yywrap ()
{
return (1);
}
%{
/*
* scan.l
*
* lex input file for pascal scanner
*
* extensions: to ways to spell "external" and "->" ok for "^".
*/
#include <stdio.h>
#include "y.tab.h"
int line_no = 1;
%}
A [aA]
B [bB]
C [cC]
D [dD]
E [eE]
F [fF]
G [gG]
H [hH]
I [iI]
J [jJ]
K [kK]
L [lL]
M [mM]
N [nN]
O [oO]
P [pP]
Q [qQ]
R [rR]
S [sS]
T [tT]
U [uU]
V [vV]
W [wW]
X [xX]
Y [yY]
Z [zZ]
NQUOTE [^']
%%
{A}{N}{D} return(AND);
{A}{R}{R}{A}{Y} return(ARRAY);
{C}{A}{S}{E} return(CASE);
{C}{O}{N}{S}{T} return(CONST);
{D}{I}{V} return(DIV);
{D}{O} return(DO);
{D}{O}{W}{N}{T}{O} return(DOWNTO);
{E}{L}{S}{E} return(ELSE);
{E}{N}{D} return(END);
{E}{X}{T}{E}{R}{N} |
{E}{X}{T}{E}{R}{N}{A}{L} return(EXTERNAL);
{F}{O}{R} return(FOR);
{F}{O}{R}{W}{A}{R}{D} return(FORWARD);
{F}{U}{N}{C}{T}{I}{O}{N} return(FUNCTION);
{G}{O}{T}{O} return(GOTO);
{I}{F} return(IF);
{I}{N} return(IN);
{L}{A}{B}{E}{L} return(LABEL);
{M}{O}{D} return(MOD);
{N}{I}{L} return(NIL);
{N}{O}{T} return(NOT);
{O}{F} return(OF);
{O}{R} return(OR);
{O}{T}{H}{E}{R}{W}{I}{S}{E} return(OTHERWISE);
{P}{A}{C}{K}{E}{D} return(PACKED);
{B}{E}{G}{I}{N} return(PBEGIN);
{F}{I}{L}{E} return(PFILE);
{P}{R}{O}{C}{E}{D}{U}{R}{E} return(PROCEDURE);
{P}{R}{O}{G}{R}{A}{M} return(PROGRAM);
{R}{E}{C}{O}{R}{D} return(RECORD);
{R}{E}{P}{E}{A}{T} return(REPEAT);
{S}{E}{T} return(SET);
{T}{H}{E}{N} return(THEN);
{T}{O} return(TO);
{T}{Y}{P}{E} return(TYPE);
{U}{N}{T}{I}{L} return(UNTIL);
{V}{A}{R} return(VAR);
{W}{H}{I}{L}{E} return(WHILE);
{W}{I}{T}{H} return(WITH);
[a-zA-Z]([a-zA-Z0-9])+ return(IDENTIFIER);
":=" return(ASSIGNMENT);
'({NQUOTE}|'')+' return(CHARACTER_STRING);
":" return(COLON);
"," return(COMMA);
[0-9]+ return(DIGSEQ);
"." return(DOT);
".." return(DOTDOT);
"=" return(EQUAL);
">=" return(GE);
">" return(GT);
"[" return(LBRAC);
"<=" return(LE);
"(" return(LPAREN);
"<" return(LT);
"-" return(MINUS);
"<>" return(NOTEQUAL);
"+" return(PLUS);
"]" return(RBRAC);
[0-9]+"."[0-9]+ return(REALNUMBER);
")" return(RPAREN);
";" return(SEMICOLON);
"/" return(SLASH);
"*" return(STAR);
"**" return(STARSTAR);
"->" |
"^" return(UPARROW);
"(*" |
"{" { register int c;
while ((c = input()))
{
if (c == '}')
break;
else if (c == '*')
{
if ((c = input()) == ')')
break;
else
unput (c);
}
else if (c == '\n')
line_no++;
else if (c == 0)
commenteof();
}
}
[ \t\f] ;
\n line_no++;
. { fprintf (stderr,
"'%c' (0%o): illegal charcter at line %d\n",
yytext[0], yytext[0], line_no);
}
%%
commenteof()
{
fprintf (stderr, "unexpected EOF inside comment at line %d\n",
line_no);
exit (1);
}
yywrap ()
{
return (1);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
LALRPOP support conditional compilation of public non-terminal declarations via `#[cfg(feature = "FEATUERE")]` attributes.
If run in a build script LALRPOP will automatically pickup the features from `cargo` and use those. Alternatively an explicit set of features can be set using the `Configuration` type.
```rust
#[cfg(feature = "FEATURE")]
pub MyRule : () = {
...
};
```
LALRPOP support conditional compilation of public non-terminal declarations via `#[cfg(feature = "FEATUERE")]` attributes.
If run in a build script LALRPOP will automatically pickup the features from `cargo` and use those. Alternatively an explicit set of features can be set using the `Configuration` type.
```rust
#[cfg(feature = "FEATURE")]
pub MyRule : () = {
...
};
```

View File

@ -8,7 +8,7 @@ workspace = ".."
[dependencies]
diff = "0.1.9"
regex = "1"
regex = "1"
[dependencies.lalrpop-util]
path = "../lalrpop-util"

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +1,58 @@
// Need this for rusty_peg
#![recursion_limit = "256"]
// I hate this lint.
#![allow(unused_parens)]
// The builtin tests don't cover the CLI and so forth, and it's just
// too darn annoying to try and make them do so.
#![cfg_attr(test, allow(dead_code))]
extern crate ascii_canvas;
extern crate atty;
extern crate bit_set;
extern crate diff;
extern crate ena;
extern crate itertools;
#[cfg_attr(any(feature = "test", test), macro_use)]
extern crate lalrpop_util;
extern crate petgraph;
extern crate regex;
extern crate regex_syntax;
extern crate sha2;
extern crate string_cache;
extern crate term;
extern crate unicode_xid;
#[cfg(test)]
extern crate rand;
// hoist the modules that define macros up earlier
#[macro_use]
mod rust;
#[macro_use]
mod log;
mod api;
mod build;
mod collections;
mod file_text;
mod grammar;
mod kernel_set;
mod lexer;
mod lr1;
mod message;
mod normalize;
mod parser;
mod session;
mod tls;
mod tok;
mod util;
#[cfg(test)]
mod generate;
#[cfg(test)]
mod test_util;
pub use api::process_root;
pub use api::process_root_unconditionally;
pub use api::Configuration;
use ascii_canvas::style;
// Need this for rusty_peg
#![recursion_limit = "256"]
// I hate this lint.
#![allow(unused_parens)]
// The builtin tests don't cover the CLI and so forth, and it's just
// too darn annoying to try and make them do so.
#![cfg_attr(test, allow(dead_code))]
extern crate ascii_canvas;
extern crate atty;
extern crate bit_set;
extern crate diff;
extern crate ena;
extern crate itertools;
#[cfg_attr(any(feature = "test", test), macro_use)]
extern crate lalrpop_util;
extern crate petgraph;
extern crate regex;
extern crate regex_syntax;
extern crate sha2;
extern crate string_cache;
extern crate term;
extern crate unicode_xid;
#[cfg(test)]
extern crate rand;
// hoist the modules that define macros up earlier
#[macro_use]
mod rust;
#[macro_use]
mod log;
mod api;
mod build;
mod collections;
mod file_text;
mod grammar;
mod kernel_set;
mod lexer;
mod lr1;
mod message;
mod normalize;
mod parser;
mod session;
mod tls;
mod tok;
mod util;
#[cfg(test)]
mod generate;
#[cfg(test)]
mod test_util;
pub use api::process_root;
pub use api::process_root_unconditionally;
pub use api::Configuration;
use ascii_canvas::style;

View File

@ -1,84 +1,84 @@
use std::iter;
use grammar::parse_tree::*;
use grammar::pattern::*;
use lalrpop_util;
use tok;
#[cfg(not(any(feature = "test", test)))]
#[allow(dead_code)]
mod lrgrammar;
#[cfg(any(feature = "test", test))]
lalrpop_mod!(
// ---------------------------------------------------------------------------------------
// NOTE: Run `cargo build -p lalrpop` once before running `cargo test` to create this file
// ---------------------------------------------------------------------------------------
#[allow(dead_code)]
lrgrammar,
"/src/parser/lrgrammar.rs"
);
#[cfg(test)]
mod test;
pub enum Top {
Grammar(Grammar),
Pattern(Pattern<TypeRef>),
MatchMapping(TerminalString),
TypeRef(TypeRef),
GrammarWhereClauses(Vec<WhereClause<TypeRef>>),
}
pub type ParseError<'input> = lalrpop_util::ParseError<usize, tok::Tok<'input>, tok::Error>;
macro_rules! parser {
($input: expr, $offset: expr, $pat: ident, $tok: ident) => {{
let input = $input;
let tokenizer =
iter::once(Ok((0, tok::Tok::$tok, 0))).chain(tok::Tokenizer::new(input, $offset));
lrgrammar::TopParser::new()
.parse(input, tokenizer)
.map(|top| match top {
Top::$pat(x) => x,
_ => unreachable!(),
})
}};
}
pub fn parse_grammar<'input>(input: &'input str) -> Result<Grammar, ParseError<'input>> {
let mut grammar = try!(parser!(input, 0, Grammar, StartGrammar));
// find a unique prefix that does not appear anywhere in the input
while input.contains(&grammar.prefix) {
grammar.prefix.push('_');
}
Ok(grammar)
}
fn parse_pattern<'input>(
input: &'input str,
offset: usize,
) -> Result<Pattern<TypeRef>, ParseError<'input>> {
parser!(input, offset, Pattern, StartPattern)
}
fn parse_match_mapping<'input>(
input: &'input str,
offset: usize,
) -> Result<MatchMapping, ParseError<'input>> {
parser!(input, offset, MatchMapping, StartMatchMapping)
}
#[cfg(test)]
pub fn parse_type_ref<'input>(input: &'input str) -> Result<TypeRef, ParseError<'input>> {
parser!(input, 0, TypeRef, StartTypeRef)
}
#[cfg(test)]
pub fn parse_where_clauses<'input>(
input: &'input str,
) -> Result<Vec<WhereClause<TypeRef>>, ParseError<'input>> {
parser!(input, 0, GrammarWhereClauses, StartGrammarWhereClauses)
}
use std::iter;
use grammar::parse_tree::*;
use grammar::pattern::*;
use lalrpop_util;
use tok;
#[cfg(not(any(feature = "test", test)))]
#[allow(dead_code)]
mod lrgrammar;
#[cfg(any(feature = "test", test))]
lalrpop_mod!(
// ---------------------------------------------------------------------------------------
// NOTE: Run `cargo build -p lalrpop` once before running `cargo test` to create this file
// ---------------------------------------------------------------------------------------
#[allow(dead_code)]
lrgrammar,
"/src/parser/lrgrammar.rs"
);
#[cfg(test)]
mod test;
pub enum Top {
Grammar(Grammar),
Pattern(Pattern<TypeRef>),
MatchMapping(TerminalString),
TypeRef(TypeRef),
GrammarWhereClauses(Vec<WhereClause<TypeRef>>),
}
pub type ParseError<'input> = lalrpop_util::ParseError<usize, tok::Tok<'input>, tok::Error>;
macro_rules! parser {
($input: expr, $offset: expr, $pat: ident, $tok: ident) => {{
let input = $input;
let tokenizer =
iter::once(Ok((0, tok::Tok::$tok, 0))).chain(tok::Tokenizer::new(input, $offset));
lrgrammar::TopParser::new()
.parse(input, tokenizer)
.map(|top| match top {
Top::$pat(x) => x,
_ => unreachable!(),
})
}};
}
pub fn parse_grammar<'input>(input: &'input str) -> Result<Grammar, ParseError<'input>> {
let mut grammar = try!(parser!(input, 0, Grammar, StartGrammar));
// find a unique prefix that does not appear anywhere in the input
while input.contains(&grammar.prefix) {
grammar.prefix.push('_');
}
Ok(grammar)
}
fn parse_pattern<'input>(
input: &'input str,
offset: usize,
) -> Result<Pattern<TypeRef>, ParseError<'input>> {
parser!(input, offset, Pattern, StartPattern)
}
fn parse_match_mapping<'input>(
input: &'input str,
offset: usize,
) -> Result<MatchMapping, ParseError<'input>> {
parser!(input, offset, MatchMapping, StartMatchMapping)
}
#[cfg(test)]
pub fn parse_type_ref<'input>(input: &'input str) -> Result<TypeRef, ParseError<'input>> {
parser!(input, 0, TypeRef, StartTypeRef)
}
#[cfg(test)]
pub fn parse_where_clauses<'input>(
input: &'input str,
) -> Result<Vec<WhereClause<TypeRef>>, ParseError<'input>> {
parser!(input, 0, GrammarWhereClauses, StartGrammarWhereClauses)
}