diff options
Diffstat (limited to 'JLanguageTool/src/rules/xx')
-rw-r--r-- | JLanguageTool/src/rules/xx/grammar.xml | 313 |
1 files changed, 313 insertions, 0 deletions
diff --git a/JLanguageTool/src/rules/xx/grammar.xml b/JLanguageTool/src/rules/xx/grammar.xml new file mode 100644 index 0000000..2dec7b4 --- /dev/null +++ b/JLanguageTool/src/rules/xx/grammar.xml @@ -0,0 +1,313 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="../print.xsl" +title="Pretty print" ?> +<?xml-stylesheet type="text/css" href="../rules.css" +title="Easy editing stylesheet" ?> +<!-- +A demo rule file for LanguageTool +Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de) +$Id$ +--> +<rules lang="xx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../rules.xsd"> + <!-- tests for phrase syntax --> + <unification feature="case_sensitivity"> + <equivalence type="startupper"> + <token regexp="yes">\p{Lu}\p{Ll}+</token> + </equivalence> + <equivalence type="lowercase"> + <token regexp="yes">\p{Ll}+</token> + </equivalence> + </unification> + <phrases> + <phrase id="UNIFICATION_PHRASE"> + <unify> + <feature id="case_sensitivity"> + <type id="startupper"/> + </feature> + <token/> + <token>York</token> + </unify> + </phrase> + <phrase id="NP"> + <token>trivial</token> + <token>phrase</token> + <token>demo</token> + <token><exception>exception</exception></token> + </phrase> + <phrase id="COMPLEX_PHRASE"> + <token>complex</token> + <includephrases> + <phraseref idref="NP"/> + </includephrases> + <token>another</token> + </phrase> + <phrase id="DUMMY_VB1"> + <token regexp="yes">go|goa</token> + </phrase> + <phrase id="DUMMY_VB2"> + <token>goes</token> + </phrase> + <phrase id="DUMMY_VB3"> + <token>went</token> + </phrase> + <phrase id="COMPLEX_MULTIPLE"> + <token>first</token> + <includephrases> + <phraseref idref="DUMMY_VB1"/> + <phraseref idref="DUMMY_VB2"/> + <phraseref idref="DUMMY_VB3"/> + </includephrases> + <token>last</token> + </phrase> + <phrase id="SINGLE_TOKEN"> + <token>single</token> + </phrase> + <phrase id="TEST_INCLUDE"> + <token>beginning</token> + <includephrases> + <phraseref idref="COMPLEX_MULTIPLE"/> + <phraseref idref="SINGLE_TOKEN"/> + </includephrases> + <token>end</token> + </phrase> + <phrase id="trivial_include"> + <includephrases> + <phraseref idref="DUMMY_VB1"/> + </includephrases> + <includephrases> + <phraseref idref="DUMMY_VB2"/> + </includephrases> + </phrase> + </phrases> + <category name="misc"> + <!-- a trivialdemo rule that matches "foo" followed by "bar" --> + <rule id="DEMO_RULE" name="Find 'foo bar'"> + <pattern case_sensitive="no" mark_from="0"> + <token>foo</token> + <token>bar</token> + </pattern> + <message>Did you mean <suggestion><match no="1"/> fuu bah</suggestion>?</message> + <example type="correct">This is <marker>fuu bah</marker>.</example> + <example correction="foo fuu bah" type="incorrect">This is <marker>foo bar</marker>.</example> + </rule> + <rule id="API_OUTPUT_TEST_RULE" name="Find 'foo bar'"> + <pattern case_sensitive="no" mark_from="1"> + <token>ach</token> + <token>thosnaĆos-sa</token> + </pattern> + <message>Did you mean <suggestion>fuu bah</suggestion>?</message> + <example type="correct">This is ach <marker>fuu bah</marker>.</example> + <example type="incorrect">This is ach <marker>thosnaĆos-sa</marker>.</example> + </rule> + <rule id="NEGATION_TOKEN" name="test negation"> + <pattern mark_from="1"> + <token>small</token> + <token negate="yes">test</token> + </pattern> + <message>test</message> + <example type="correct">a small <marker>test</marker></example> + <example type="incorrect">a small <marker>toast</marker></example> + </rule> + <rule id="TEST_GO" name="another test of phrases"> + <pattern> + <token>foo</token> + <phraseref idref="DUMMY_VB1"/> + </pattern> + <message>Error!</message> + <example type="correct">foo bar</example> + <example type="incorrect"><marker>foo go</marker></example> + <example type="incorrect"><marker>foo go</marker> bar</example> + <example type="incorrect"><marker>foo goa</marker> bar</example> + </rule> + <rule id="TEST_PHRASES1" name="test phrases mechanism"> + <pattern> + <phraseref idref="COMPLEX_MULTIPLE"/> + <token>there</token> + </pattern> + <message>This is the matched text: <match no="1"/><match no="2"/></message> + <example type="correct">go here</example> + <example type="incorrect"><marker>first goes last there</marker>, please!</example> + </rule> + <rule id="test_include" name="test two includeblocks"> + <pattern> + <phraseref idref="TEST_INCLUDE"/> + </pattern> + <message>Matched: <suggestion>test <match no="1"/>trala</suggestion></message> + <example type="correct">Any string.</example> + <example type="incorrect">Some words, <marker>beginning first go last end</marker></example> + </rule> + <rule id="test_include_and_skip" name="test two includeblocks"> + <pattern> + <token skip="2">any</token> + <phraseref idref="TEST_INCLUDE"/> + <token>word</token> + </pattern> + <message>Matched: <suggestion><match no="1"/> test</suggestion></message> + <example type="correct">Any string.</example> + <example type="incorrect">Some words, <marker>any word beginning first go last end word</marker></example> + </rule> + <!-- why should this work this way? two phraserefs generate a logical + disjunction for some obscure reason! --> + <rule id="test_two_phrases" name="test two phrases"> + <pattern> + <phraseref idref="COMPLEX_MULTIPLE"/> + <phraseref idref="SINGLE_TOKEN"/> + </pattern> + <message>Matched: <match no="1"/></message> + <example type="correct">Any string.</example> + <example type="incorrect">First words and <marker>first go last</marker></example> + </rule> + <rule id="test_and_operator" name="test logical AND"> + <pattern mark_to="-1"> + <and> + <token regexp="yes">A.*</token> + <token regexp="yes">[A-Z]B.*</token> + <token negate="yes">ABC</token> + <token regexp="yes">.*D<exception>ABED</exception></token> + </and> + <token>test</token> + </pattern> + <message>Matched: <match no="1"/></message> + <example type="correct">CB test</example> + <example type="correct">ABC test</example> + <example type="incorrect"><marker>ABCD</marker> test</example> + <example type="incorrect"><marker>ABEED</marker> test</example> + <example type="correct"><marker>ABED</marker> test</example> + </rule> + <rule id="test_match_ref" name="testing match element..."> + <pattern> + <token/> + <token>by</token> + <token><match no="0"/></token> + </pattern> + <message>Found \1 \2 \3.</message> + <example type="incorrect"><marker>Step by step</marker>.</example> + <example type="correct">blabla</example> + <example type="correct">Steb by step</example> + </rule> + <rule id="test_match_ref_superb" name="testing match element on steroids..."> + <pattern> + <token/> + <token>by</token> + <token><match no="0"/>on</token> + </pattern> + <message>Found \1 \2 \3.</message> + <example type="correct"><marker>Step by step</marker>.</example> + <example type="incorrect"><marker>Step by stepon</marker>.</example> + <example type="correct">blabla</example> + <example type="correct">Steb by step</example> + </rule> + <rulegroup id="test_matching_tokens" name="test parseInt conversion1"> + <rule> + <pattern> + <token>1</token> + <token>2</token> + <token>3</token> + <token>4</token> + <token>5</token> + <token/> + <token>7</token> + <token>8</token> + <token/> + <token>10</token> + </pattern> + <message>I suggest: <suggestion><match no="10"/> blahblah</suggestion>.</message> + <example type="correct">blah</example> + <example correction="10 blahblah" type="incorrect"><marker>1 2 3 4 5 6 7 8 9 10</marker>.</example> + </rule> + <rule> + <pattern> + <token>1</token> + <token>2</token> + <token>3</token> + <token>4</token> + <token>5</token> + <token/> + <token>7</token> + <token>8</token> + <token/> + <token>10</token> + </pattern> + <message>I suggest: <suggestion>\10 blahblah</suggestion>.</message> + <example type="correct">blah</example> + <example correction="10 blahblah" type="incorrect"><marker>1 2 3 4 5 6 7 8 9 10</marker>.</example> + </rule> + </rulegroup> + <rule id="test_match_conv" name="example of case conversion"> + <pattern case_sensitive="yes"> + <token>new-york</token> + <token>cafe</token> + </pattern> + <message>This name should be uppercase: <suggestion>New <match case_conversion="startupper" no="1" regexp_match="[Nn]ew-(.*)" regexp_replace="$1"/> Cafe</suggestion></message> + <example type="correct">New York Cafe</example> + <example correction="New York Cafe" type="incorrect">This is a new coffeshop in the middle of nowhere called <marker>new-york cafe</marker>.</example> + </rule> + <rule id="test_unification" name="Test unification of character case"> + <pattern case_sensitive="yes" mark_from="1"> + <token>abc</token> + <unify> <feature id="case_sensitivity"> + <type id="startupper"/> + </feature> + <token/> + <token>York</token> + </unify> + </pattern> + <message>Warning: \1 \2 \3!</message> + <example type="incorrect">abc <marker>New York</marker></example> + <example type="correct">abc new York</example> + </rule> + <rule id="test_unification_negate" name="Test negated unification of character case"> + <pattern case_sensitive="yes" mark_from="1"> + <token>abc</token> + <unify negate="yes"> + <feature id="case_sensitivity"> + <type id="startupper"/> + </feature> + <token/> + <token regexp="yes">[yY]ork</token> + </unify> + </pattern> + <message>Warning: \1 \2 \3!</message> + <example type="incorrect">abc <marker>new York</marker></example> + <example type="incorrect">abc <marker>New york</marker></example> + <example type="incorrect">abc <marker>new york</marker></example> + <example type="correct">abc New York</example> + </rule> + <rule id="test_unification_phrase" name="Test unification of characters' case via phrase"> + <pattern case_sensitive="yes" mark_from="1"> + <token>abc</token> + <phraseref idref="UNIFICATION_PHRASE"/> + </pattern> + <message>Warning: \1 \2 \3!</message> + <example type="incorrect">abc <marker>New York</marker></example> + <example type="correct">abc new York</example> + </rule> + <rule id="test_include_skipped" name="Test inclusion of skipped tokens"> + <pattern> + <token skip="-1">abc</token> + <token>end</token> + </pattern> + <message>Warning: <suggestion><match no="1" include_skipped="all"/> xyz</suggestion></message> + <example type="incorrect" correction="abcdef ghi xyz">This is <marker>abc def ghi end</marker>.</example> + <example type="correct">foobar</example> + </rule> + <rule id="test_unification_skipping" name="Test unification and skipping"> + <pattern case_sensitive="yes"> + <token>Test1</token> + <unify> + <feature id="case_sensitivity"/> + <token skip="-1"><exception scope="next">Ghj</exception></token> + <token regexp="yes">[xX]yz</token> + </unify> + <token>end</token> + </pattern> + <message>This is not visible anyway<suggestion><match no="2" include_skipped="all"/></suggestion>.</message> + <example type="incorrect" correction="Abc">This is <marker>Test1 Abc Xyz end</marker>.</example> + <example type="incorrect" correction="AbcDef">This is <marker>Test1 Abc Def Xyz end</marker>.</example> + <!-- skipped elements are NOT unified --> + <example type="incorrect" correction="Abcdef">This is <marker>Test1 Abc def Xyz end</marker>.</example> + <example type="correct">This is Test1 abc Cde End.</example> + </rule> + </category> +</rules>
\ No newline at end of file |