diff --git a/org.dadacoalition.yedit.test/scanner-test-files/key-accented-chars-tests.yaml b/org.dadacoalition.yedit.test/scanner-test-files/key-accented-chars-tests.yaml new file mode 100644 index 0000000..2509d27 --- /dev/null +++ b/org.dadacoalition.yedit.test/scanner-test-files/key-accented-chars-tests.yaml @@ -0,0 +1,41 @@ +--- +name: Parsing keys with accented characters +contentFile: key-accented-chars.yaml +rangeLength: -1 +startOffset: 0 +expectedTokens: + + - type: DOCUMENT_START + + # Poèmes + - type: WHITESPACE + - type: KEY + + # Poème1 + - type: WHITESPACE + - type: KEY + + - type: WHITESPACE + - type: KEY + - type: WHITESPACE + - type: SCALAR + + - type: WHITESPACE + - type: KEY + - type: WHITESPACE + - type: SCALAR + + - type: WHITESPACE + - type: KEY + - type: WHITESPACE + - type: SCALAR + + # Prop2 + - type: WHITESPACE + - type: KEY + + - type: WHITESPACE + - type: KEY + - type: WHITESPACE + - type: SCALAR + diff --git a/org.dadacoalition.yedit.test/scanner-test-files/key-accented-chars.yaml b/org.dadacoalition.yedit.test/scanner-test-files/key-accented-chars.yaml new file mode 100644 index 0000000..6bfe47e --- /dev/null +++ b/org.dadacoalition.yedit.test/scanner-test-files/key-accented-chars.yaml @@ -0,0 +1,9 @@ +--- +Poèmes: + Poème1: + MaîtreCorbeau: value + SurUnArbrePerché: value + î: value + Prop2: + grünen: value + diff --git a/org.dadacoalition.yedit.test/src/org/dadacoalition/yedit/test/scanner/YAMLScannerTest.java b/org.dadacoalition.yedit.test/src/org/dadacoalition/yedit/test/scanner/YAMLScannerTest.java index 2786587..d546076 100644 --- a/org.dadacoalition.yedit.test/src/org/dadacoalition/yedit/test/scanner/YAMLScannerTest.java +++ b/org.dadacoalition.yedit.test/src/org/dadacoalition/yedit/test/scanner/YAMLScannerTest.java @@ -66,7 +66,8 @@ public static Collection readTests() { "comment-tests.yaml", "tag-tests.yaml", "scalar-test.yaml", - "key-tests.yaml" + "key-tests.yaml", + "key-accented-chars-tests.yaml" }; Collection testCases = new ArrayList(); diff --git a/org.dadacoalition.yedit/src/org/dadacoalition/yedit/editor/scanner/KeyRule.java b/org.dadacoalition.yedit/src/org/dadacoalition/yedit/editor/scanner/KeyRule.java index 34fa330..7acd961 100644 --- a/org.dadacoalition.yedit/src/org/dadacoalition/yedit/editor/scanner/KeyRule.java +++ b/org.dadacoalition.yedit/src/org/dadacoalition/yedit/editor/scanner/KeyRule.java @@ -23,12 +23,12 @@ */ public class KeyRule implements IRule { - private IToken token; + private IToken token; private Pattern keyPattern; public KeyRule( IToken token ){ this.token = token; - keyPattern = Pattern.compile( getKeyRegex(), Pattern.DOTALL | Pattern.COMMENTS ); + keyPattern = Pattern.compile( getKeyRegex(), Pattern.DOTALL | Pattern.COMMENTS | Pattern.UNICODE_CHARACTER_CLASS); } public IToken evaluate(ICharacterScanner scanner) {