Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
fix case
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiazya committed Jun 9, 2021
1 parent 8bad62e commit de82e45
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 44 deletions.
36 changes: 18 additions & 18 deletions grammar/dot.peggy
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/

start
= Graph
= graph

Graph
= _ strict:"strict"i? _ type:("graph"i / "digraph"i) _ id:_literal? _ "{" body:ClusterStatements ? _ "}" _ {
graph
= _ strict:"strict"i? _ type:("graph"i / "digraph"i) _ id:_literal? _ "{" body:cluster_statements ? _ "}" _ {
return {
type: 'graph',
id,
Expand All @@ -19,10 +19,10 @@ Graph
};
}

ClusterStatements
cluster_statements
= _ s:_cluster_statement _ ";"? e:(_ other:_cluster_statement _";"? { return other; })* { return [s].concat(e); }

Attribute
attribute
= key:_literal _ '=' _ value:_literal ';'? {
return {
type: 'attribute',
Expand All @@ -32,7 +32,7 @@ Attribute
};
}

Attributes
attributes
= kind:('graph'i/'node'i/'edge'i) attributes:_attribute_list ';'? {
return {
type: 'attributes',
Expand All @@ -42,7 +42,7 @@ Attributes
};
}

Edge
edge
= id:(_edge_target) rhs:_edge_rhs attributes:_attribute_list? ';'? {
return {
type: 'edge',
Expand All @@ -52,7 +52,7 @@ Edge
};
}

Node
node
= id:_literal attributes:_attribute_list?';'? {
return {
type: 'node',
Expand All @@ -63,11 +63,11 @@ Node
}

_cluster_statement
= Attribute
/ Attributes
/ Edge
/ Subgraph
/ Node
= attribute
/ attributes
/ edge
/ subgraph
/ node

_attribute_list
= _ '[' _ list:_a_list? _ ']' _ rest:_attribute_list? {
Expand All @@ -80,7 +80,7 @@ _a_list
}

_id_list
= _ id:NodeRef _ ',' ? rest:_id_list? {
= _ id:node_ref _ ',' ? rest:_id_list? {
return [id].concat(rest || []);
}

Expand All @@ -90,14 +90,14 @@ _edge_target_group
}

_edge_target
= _edge_target_group / NodeRef
= _edge_target_group / node_ref

_edge_rhs
= _ edgeop:('->'/'--') _ id:_edge_target _ rest:_edge_rhs? {
return [id].concat(rest || []);
}

NodeRef
node_ref
= id:_literal port:_port? {
return port ? {
type: 'node_ref',
Expand All @@ -121,8 +121,8 @@ _port 'port'
return { port };
}

Subgraph
= id:('subgraph'i _ _id:_literal? _ { return _id; })? '{' body:ClusterStatements? _ '}' {
subgraph
= id:('subgraph'i _ _id:_literal? _ { return _id; })? '{' body:cluster_statements? _ '}' {
if (id) {
return {
type:'subgraph',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"parser"
],
"scripts": {
"build:peggy": "peggy --plugin ts-pegjs --allowed-start-rules Graph,Subgraph,Node,Edge,Attributes,Attribute,ClusterStatements -o src/dot.peggy.ts grammar/dot.peggy && prettier --write './src/dot.peggy.ts'",
"build:peggy": "peggy --plugin ts-pegjs --allowed-start-rules graph,subgraph,node,edge,attributes,attribute,cluster_statements -o src/dot.peggy.ts grammar/dot.peggy && prettier --write './src/dot.peggy.ts'",
"prebuild": "yarn build:peggy",
"build": "rollup -c && prettier --write './lib/index.d.ts'",
"pretest": "yarn build:peggy",
Expand Down
50 changes: 25 additions & 25 deletions src/dot.peggy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ function peg$parse(input: string, options?: IParseOptions) {
const peg$FAILED: Readonly<any> = {};

const peg$startRuleFunctions: { [id: string]: any } = {
Graph: peg$parseGraph,
Subgraph: peg$parseSubgraph,
Node: peg$parseNode,
Edge: peg$parseEdge,
Attributes: peg$parseAttributes,
Attribute: peg$parseAttribute,
ClusterStatements: peg$parseClusterStatements,
graph: peg$parsegraph,
subgraph: peg$parsesubgraph,
node: peg$parsenode,
edge: peg$parseedge,
attributes: peg$parseattributes,
attribute: peg$parseattribute,
cluster_statements: peg$parsecluster_statements,
};
let peg$startRuleFunction: () => any = peg$parseGraph;
let peg$startRuleFunction: () => any = peg$parsegraph;

const peg$c0 = 'strict';
const peg$c1 = peg$literalExpectation('strict', true);
Expand Down Expand Up @@ -2191,7 +2191,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return new SyntaxError(SyntaxError.buildMessage(expected1, found), expected1, found, location1);
}

function peg$parseGraph(): any {
function peg$parsegraph(): any {
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;

s0 = peg$currPos;
Expand Down Expand Up @@ -2252,7 +2252,7 @@ function peg$parse(input: string, options?: IParseOptions) {
}
}
if ((s8 as any) !== peg$FAILED) {
s9 = peg$parseClusterStatements();
s9 = peg$parsecluster_statements();
if ((s9 as any) === peg$FAILED) {
s9 = null;
}
Expand Down Expand Up @@ -2326,7 +2326,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return s0;
}

function peg$parseClusterStatements(): any {
function peg$parsecluster_statements(): any {
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;

s0 = peg$currPos;
Expand Down Expand Up @@ -2459,7 +2459,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return s0;
}

function peg$parseAttribute(): any {
function peg$parseattribute(): any {
let s0, s1, s2, s3, s4, s5, s6;

s0 = peg$currPos;
Expand Down Expand Up @@ -2525,7 +2525,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return s0;
}

function peg$parseAttributes(): any {
function peg$parseattributes(): any {
let s0, s1, s2, s3;

s0 = peg$currPos;
Expand Down Expand Up @@ -2595,7 +2595,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return s0;
}

function peg$parseEdge(): any {
function peg$parseedge(): any {
let s0, s1, s2, s3, s4;

s0 = peg$currPos;
Expand Down Expand Up @@ -2644,7 +2644,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return s0;
}

function peg$parseNode(): any {
function peg$parsenode(): any {
let s0, s1, s2, s3;

s0 = peg$currPos;
Expand Down Expand Up @@ -2690,15 +2690,15 @@ function peg$parse(input: string, options?: IParseOptions) {
function peg$parse_cluster_statement(): any {
let s0;

s0 = peg$parseAttribute();
s0 = peg$parseattribute();
if ((s0 as any) === peg$FAILED) {
s0 = peg$parseAttributes();
s0 = peg$parseattributes();
if ((s0 as any) === peg$FAILED) {
s0 = peg$parseEdge();
s0 = peg$parseedge();
if ((s0 as any) === peg$FAILED) {
s0 = peg$parseSubgraph();
s0 = peg$parsesubgraph();
if ((s0 as any) === peg$FAILED) {
s0 = peg$parseNode();
s0 = peg$parsenode();
}
}
}
Expand Down Expand Up @@ -2904,7 +2904,7 @@ function peg$parse(input: string, options?: IParseOptions) {
s0 = peg$currPos;
s1 = peg$parse_();
if ((s1 as any) !== peg$FAILED) {
s2 = peg$parseNodeRef();
s2 = peg$parsenode_ref();
if ((s2 as any) !== peg$FAILED) {
s3 = peg$parse_();
if ((s3 as any) !== peg$FAILED) {
Expand Down Expand Up @@ -3012,7 +3012,7 @@ function peg$parse(input: string, options?: IParseOptions) {

s0 = peg$parse_edge_target_group();
if ((s0 as any) === peg$FAILED) {
s0 = peg$parseNodeRef();
s0 = peg$parsenode_ref();
}

return s0;
Expand Down Expand Up @@ -3087,7 +3087,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return s0;
}

function peg$parseNodeRef(): any {
function peg$parsenode_ref(): any {
let s0, s1, s2;

s0 = peg$currPos;
Expand Down Expand Up @@ -3184,7 +3184,7 @@ function peg$parse(input: string, options?: IParseOptions) {
return s0;
}

function peg$parseSubgraph(): any {
function peg$parsesubgraph(): any {
let s0, s1, s2, s3, s4, s5;

s0 = peg$currPos;
Expand Down Expand Up @@ -3241,7 +3241,7 @@ function peg$parse(input: string, options?: IParseOptions) {
}
}
if ((s2 as any) !== peg$FAILED) {
s3 = peg$parseClusterStatements();
s3 = peg$parsecluster_statements();
if ((s3 as any) === peg$FAILED) {
s3 = null;
}
Expand Down

0 comments on commit de82e45

Please sign in to comment.