Skip to content

Commit

Permalink
updated sum formula grammar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Kopczynski committed May 13, 2020
2 parents a06cd9f + 3c66c4c commit 89a5f47
Show file tree
Hide file tree
Showing 4 changed files with 342 additions and 311 deletions.
33 changes: 33 additions & 0 deletions FattyAcids.g4
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
////////////////////////////////////////////////////////////////////////////////
// MIT License
//
// Copyright (c) 2017 Dominik Kopczynski - dominik.kopczynski {at} isas.de
// Nils Hoffmann - nils.hoffmann {at} isas.de
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
////////////////////////////////////////////////////////////////////////////////


grammar FattyAcids;

/* first rule is always start rule */
fatt_acid: fatty_rule EOF;
count: digit;
digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | digit digit;

2 changes: 1 addition & 1 deletion LipidMaps.g4
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ dpl_subspecies: round_open_bracket fa2 round_close_bracket | fa2;
cl: hg_clc cl_species | hg_clc cl_subspecies;
cl_species: round_open_bracket fa round_close_bracket | fa;
cl_subspecies: round_open_bracket '1\'-' square_open_bracket fa2 square_close_bracket ',3\'-' square_open_bracket fa2 square_close_bracket round_close_bracket | hg_clc '1\'-' square_open_bracket fa2 square_close_bracket ',3\'-' square_open_bracket fa2 square_close_bracket;
fourpl: hg_fourplc round_open_bracket fa4 round_close_bracket | hg_fourplc fa4;
fourpl: hg_fourplc round_open_bracket fa4 round_close_bracket | hg_fourplc fa4 | hg_fourplc round_open_bracket species_fa round_close_bracket | hg_fourplc species_fa;
threepl: hg_threeplc round_open_bracket fa3 round_close_bracket | hg_threeplc fa3 | hg_threeplc round_open_bracket species_fa round_close_bracket | hg_threeplc species_fa;

hg_ddpl: hg_dplc pip_position | hg_dplc;
Expand Down
19 changes: 10 additions & 9 deletions sum-formula.g4 → SumFormula.g4
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
//// This is a BNF grammer for lipid subspecies identifiers followed by
//// J.K. Pauling et al. 2017, PLoS One, 12(11):e0188394.

grammar MoleculeFormula;
grammar SumFormula;

/* first rule is always start rule */
Molecule: Molecule_Rule EOF;
Molecule_Rule: Molecule_Group;
Molecule_Group: Element_Group | Single_Element | Molecule_Group Molecule_Group;
Element_Group: Element Count;
Single_Element: Element;
Element: 'C' | 'H' | 'N' | 'O' | 'P' | 'S';
Count: Number;
Number: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | Number Number;
molecule: molecule_rule EOF;
molecule_rule: molecule_group;
molecule_group: element_group | single_element | molecule_group molecule_group;
element_group: element count;
single_element: element;
element: 'C' | 'H' | 'N' | 'O' | 'P' | 'S';
count: digit;
digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | digit digit;

Loading

0 comments on commit 89a5f47

Please sign in to comment.