Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenquotes.git
lib/src/main/java/com/keenwrite/quotes/Lexer.java
isWord = true;
- if( !isLetterOrDigit( peek( i ) ) ) {
+ if( !isLetter( peek( i ) ) ) {
lexeme = createLexeme( WORD, began, i.getIndex() );
}
lib/src/main/java/com/keenwrite/quotes/Parser.java
}
- for( final var lex : mLexemes ) {
- parse( lex, consumer );
+ // Parse the remaining lexemes because the EOT lexeme will terminate the
+ // loop above without having examined the last lexemes.
+ for( int i = 0; i < mLexemes.size(); i++ ) {
+ parse( mLexemes.get( i ), consumer );
}
// Convert remaining single quotes to apostrophes.
-
-
}
lib/src/test/java/com/keenwrite/quotes/LexerTest.java
testType( "abc", WORD );
testType( "abc abc", WORD, SPACE, WORD );
- testType( "abc123", WORD );
+ testType( "abc123", WORD, NUMBER );
testType( "-123abc", PUNCT, NUMBER, WORD );
testType( "abc-o'-abc", WORD, PUNCT, WORD, QUOTE_SINGLE, PUNCT, WORD );
lib/src/test/resources/com/keenwrite/quotes/smartypants.txt
She stood 5'7".
+\"What?\"
+"What?"
+
# ########################################################################
# Primes (single, double)
+7.9'' is weird.
+7.9&Prime; is weird.
+
+12" record, 5'10" height
+12&Prime; record, 5&prime;10&Prime; height
Use 11.5"x14.25" virtual paper!
'"Trouble's my name."'
&lsquo;&ldquo;Trouble&apos;s my name.&ldquo;&lsquo;
-
-# ########################################################################
-# Escaped quotes
-# ########################################################################
-\"What?\"
-&ldquo;What?&rdquo;
# ########################################################################
'He's at Sams'
&lsquo;He&apos; at Sams&rsquo;
-
-\"Hello!\"
-&ldquo;Hello!&rdquo;
ma'am
'He said, \"I want to go.\"' Were you alive in the 70's?
-&lsquo;He said, &ldquo;I want to go.&rdquo;&rsquo; Were you alive in the 70&apos;s?
+&lsquo;He said, "I want to go."&rsquo; Were you alive in the 70&apos;s?
\"That's a 'magic' sock.\"
-&ldquo;That&apos;s a &lsquo;magic&rsquo; sock.&rdquo;
+"That&apos;s a &lsquo;magic&rsquo; sock."
-Website! Company Name, Inc. (\"Company Name\" or \"Company\") recommends reading the following terms and conditions, carefully:
+Website! Company Name, Inc. ("Company Name" or "Company") recommends reading the following terms and conditions, carefully:
Website! Company Name, Inc. (&ldquo;Company Name&rdquo; or &ldquo;Company&rdquo;) recommends reading the following terms and conditions, carefully:
'70s fashion was weird.
&apos;70s fashion was weird.
-
-12\" record, 5'10\" height
-12&Prime; record, 5&prime;10&Prime; height
Model \"T2000\"
-Model &ldquo;T2000&rdquo;
+Model "T2000"
iPad 3's battery life is not great.

Parse ending lexemes

Author Dave Jarvis <email>
Date 2021-06-01 21:54:33 GMT-0700
Commit 5499eb148288dd8ff1f76f8dd70859f7f3bde769
Parent 100fc76
Delta 16 lines added, 22 lines removed, 6-line decrease