Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extending Hunter with indentation juggling facilities; +1 Eiffel grammar
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@1065 ab42f6e0-554d-0410-b580-99e487e6eeb2
- Loading branch information
1 parent
166ae71
commit 50e5fac
Showing
5 changed files
with
370 additions
and
18 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,6 @@ | ||
extract: | ||
../../hunter.py src.the.syntax.txt config.edd eiffel.raw.bgf | ||
${tooldir}/xbgf post-extract.xbgf eiffel.raw.bgf eiffel.ext.bgf | ||
${tooldir}/xbgf complete.xbgf eiffel.ext.bgf eiffel.bgf | ||
|
||
include ../../Makefile.include |
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,212 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xbgf:sequence xmlns:xbgf="http://planet-sl.org/xbgf" xmlns:bgf="http://planet-sl.org/bgf"> | ||
<!-- | ||
An identifier is a sequence of one or more characters, of which the first is a letter (a to z and A to Z) and each of the subsequent ones, | ||
if any, is a letter, a decimal digit (0 to 9) or an underscore character (_). | ||
Letter case is not significant for letters: the two identifiers lInKeD_liST and LINKED_LIST are considered the same. | ||
--> | ||
<xbgf:define> | ||
<bgf:production> | ||
<nonterminal>Identifier</nonterminal> | ||
<bgf:expression> | ||
<sequence> | ||
<bgf:expression> | ||
<nonterminal>Letter</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<star> | ||
<bgf:expression> | ||
<choice> | ||
<bgf:expression> | ||
<nonterminal>Letter</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<terminal>_</terminal> | ||
</bgf:expression> | ||
</choice> | ||
</bgf:expression> | ||
</star> | ||
</bgf:expression> | ||
</sequence> | ||
</bgf:expression> | ||
</bgf:production> | ||
</xbgf:define> | ||
<!-- | ||
An integer is a sequence of characters, each of which must be either: | ||
a decimal digit (0 to 9) | ||
an underscore (_), which may not be the first character. | ||
If any underscore is present, then there must be three digits to the right of every underscore, and there must not be | ||
any consecutive group of four digits. | ||
--> | ||
<xbgf:define> | ||
<bgf:production> | ||
<nonterminal>Integer</nonterminal> | ||
<bgf:expression> | ||
<choice> | ||
<bgf:expression> | ||
<plus> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
</plus> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<sequence> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<optional> | ||
<bgf:expression> | ||
<sequence> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<optional> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
</optional> | ||
</bgf:expression> | ||
</sequence> | ||
</bgf:expression> | ||
</optional> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<plus> | ||
<bgf:expression> | ||
<sequence> | ||
<bgf:expression> | ||
<terminal>_</terminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<nonterminal>Decimal_digit</nonterminal> | ||
</bgf:expression> | ||
</sequence> | ||
</bgf:expression> | ||
</plus> | ||
</bgf:expression> | ||
</sequence> | ||
</bgf:expression> | ||
</choice> | ||
</bgf:expression> | ||
</bgf:production> | ||
</xbgf:define> | ||
<!-- | ||
Hexadecimal_constant | ||
An hexadecimal constant is a sequence of two or more characters, whose first character is a decimal digit (0 to 9), | ||
whose subsequent characters but the last are decimal digits or letters a to f or A to F, and followed by x or X, | ||
with no other intervening characters. | ||
--> | ||
<!-- | ||
Real | ||
A real number is made of the following elements: | ||
an optional Integer, giving the integral part (If this is absent, the integral part is 0.) | ||
a required dot (.) | ||
an optional Integer written backwards, which gives the fractional part (if this is absent, the fractional part is 0.) | ||
an optional exponent, which is the letter e or E followed by an optional Sign (+ or -) and an Integer. | ||
The integer is required if the e or E is present. This indicates that the value appearing before the e or E must | ||
be scaled by 10^n, where n is the given integer. | ||
No intervening character (blank or otherwise) is permitted between these elements. | ||
The integral and fractional parts may not both be absent. If underscores are used in the integral or the fractional part, | ||
they must also appear in the other part, unless it has three digits or less. | ||
--> | ||
<!-- | ||
Character_constant | ||
A character constant is either: | ||
a printable character except percent (%) and single quote (') | ||
a Special_character | ||
enclosed in single quotes ('). | ||
--> | ||
<!-- | ||
Manifest_string | ||
A manifest string is an arbitrary sequence of: | ||
printable characters except percent (%) and double quote (") | ||
Special_characters | ||
enclosed in double quotes ("). | ||
An extended form allows one to write a manifest string on two or more lines. Every line but the last must end | ||
with a percent (%) and every line but the first must begin with a percent (%) possibly preceded by blanks ( ) and tab characters. | ||
--> | ||
<!-- | ||
Bit_constant | ||
A bit constant is a sequence of digits 0 or 1, followed by b or B, with no other intervening characters. | ||
--> | ||
<!-- | ||
Free_operator | ||
A free operator is a sequence of one or more characters, whose first character is any one of @ # | & and whose subsequent | ||
characters, if any, may be any printable characters. Letter case is not significant for letters in free operators. | ||
--> | ||
<!-- | ||
Comment | ||
A comment begins with two dash characters (- -) and extends to the end of the line. | ||
An extended form allows one to write a comment on two or more lines. Every line but the first must begin | ||
with two dash characters possibly preceded by blanks and tab characters. | ||
Header_comment | ||
Comment | ||
--> | ||
<!-- | ||
Break | ||
A break is made of a sequence of one or more of the following characters: | ||
blank | ||
tab | ||
new line | ||
A break can be inserted between two adjacent elements without affecting the semantics. | ||
--> | ||
<!-- | ||
Special_character | ||
A special character has one of the following forms: | ||
a sequence %/code/ where code is an unsigned integer representing the character of ASCII code code in decimal value | ||
a sequence %K used to represent the following special characters: | ||
@ %A At-sign | ||
BS %B Backspace | ||
^ %C Circumflex | ||
$ %D Dollar | ||
FF %F Form feed | ||
\ %H backslasH | ||
~ %L tiLda | ||
NL (LF) %N Newline | ||
` %Q back Quote | ||
CR %R carriage Return | ||
# %S Sharp | ||
HT %T horizontal Tab | ||
NUL %U nUll character | ||
| %V Vertical bar | ||
% %% percent | ||
' %' single quote | ||
" %" double quote | ||
[ %( opening bracket | ||
] %) closing bracket | ||
{ %< opening brace | ||
} %> closing brace | ||
--> | ||
<!-- | ||
Reserved_word | ||
A reserved word is either: | ||
a keyword, which serves to introduce and delimit the variant components of constructs. The Eiffel keywords are: | ||
alias, all, and, as, check, class, creation, debug, deferred, do, else, elseif, end, ensure, expanded, export, | ||
external, feature, from, frozen, if, implies, indexing, infix, inherit, inspect, invariant, is, like, local, loop, | ||
not, obsolete, old, once, or, prefix, redefine, rename, require, rescue, retry, select, separate, then, undefine, | ||
until, variant, when, xor. | ||
a predefined name, which comes at positions where variable tokens would also be permissible. The Eiffel predefined names are: | ||
BIT, Current, False, Precursor, Result, Strip, True, Unique. | ||
The letter case is not significant for reserved words: the two words Result and rEsUlT are considered the same. | ||
--> | ||
<!-- | ||
Semicolon | ||
Semicolons are used as separators in lists such as Index_list or Compound. Semicolons are optional in most places. However they are required in some cases to remove ambiguities in Assertion and Compound. The ambiguity appears in the following piece of code: | ||
foo (expr).bar | ||
where this could be recognized as "bar applied to the result of function foo with argument expr" or as "a call to foo followed by bar applied to expr". The rule to resolve this ambiguity is to put a semicolon between 'foo' and '(expr).bar' to get the second interpretation, or to leave it as it is to get the first one. | ||
--> | ||
</xbgf:sequence> |
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,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<edd:config xmlns:edd="http://planet-sl.org/edd"> | ||
<consider-indentation/> | ||
<tabulation-symbol> </tabulation-symbol> | ||
<defining-symbol>@@@0-1</defining-symbol> | ||
<terminator-symbol>@@@1-0</terminator-symbol> | ||
<definition-separator-symbol>|</definition-separator-symbol> | ||
<start-option-symbol>[</start-option-symbol> | ||
<end-option-symbol>]</end-option-symbol> | ||
<start-star-symbol>{</start-star-symbol> | ||
<end-star-symbol>...}</end-star-symbol> | ||
<start-plus-symbol>{</start-plus-symbol> | ||
<end-plus-symbol>...}+</end-plus-symbol> | ||
<undefined-nonterminals-are-terminals/> | ||
<terminal-if-uppercase/> | ||
<nonterminal-if-contains>_</nonterminal-if-contains> | ||
<nonterminal-if-camelcase> | ||
<except>Result</except> | ||
<except>Current</except> | ||
<except>True</except> | ||
<except>False</except> | ||
</nonterminal-if-camelcase> | ||
<glue-nonalphanumeric-terminals/> | ||
<ignore> | ||
<newline/> | ||
<same-indentation/> | ||
</ignore> | ||
</edd:config> |
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,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xbgf:sequence xmlns:xbgf="http://planet-sl.org/xbgf" xmlns:bgf="http://planet-sl.org/bgf"> | ||
<!-- Disambiguating the terminal "Unique" with the nonterminal Unique --> | ||
<xbgf:replace> | ||
<bgf:expression> | ||
<nonterminal>Unique</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<terminal>Unique</terminal> | ||
</bgf:expression> | ||
<in> | ||
<nonterminal>Unique</nonterminal> | ||
</in> | ||
</xbgf:replace> | ||
<!-- Disambiguating the terminal "Precursor" with the nonterminal Precursor --> | ||
<xbgf:replace> | ||
<bgf:expression> | ||
<nonterminal>Precursor</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<terminal>Precursor</terminal> | ||
</bgf:expression> | ||
<in> | ||
<nonterminal>Precursor</nonterminal> | ||
</in> | ||
</xbgf:replace> | ||
<!-- Disambiguating the terminal "Strip" with the nonterminal Strip --> | ||
<xbgf:replace> | ||
<bgf:expression> | ||
<nonterminal>Strip</nonterminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<terminal>Strip</terminal> | ||
</bgf:expression> | ||
<in> | ||
<nonterminal>Strip</nonterminal> | ||
</in> | ||
</xbgf:replace> | ||
<!-- Empty is a metasymbol (written in red), not a terminal symbol (in bold) --> | ||
<xbgf:replace> | ||
<bgf:expression> | ||
<terminal>empty</terminal> | ||
</bgf:expression> | ||
<bgf:expression> | ||
<epsilon/> | ||
</bgf:expression> | ||
</xbgf:replace> | ||
</xbgf:sequence> |
Oops, something went wrong.