Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arty Buldauskas
committed
Sep 10, 2017
1 parent
5c62c13
commit 5c81612
Showing
13 changed files
with
150 additions
and
22 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
Empty file.
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
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
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
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
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
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
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
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
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
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
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,36 @@ | ||
import token from '../token'; | ||
import Syntax from '../../Syntax'; | ||
|
||
const quoteOK = quoteCheck => char => quoteCheck; | ||
const nextFails = () => null; | ||
|
||
const endsInSingleQuote = char => { | ||
if (char === '\\') | ||
return quoteOK(endsInSingleQuote); | ||
if (char === '\'') | ||
return nextFails; | ||
|
||
return endsInSingleQuote; | ||
} | ||
|
||
const endsInDoubleQuote = char => { | ||
if (char === '\\') | ||
return quoteOK(endsInDoubleQuote); | ||
if (char === '"') | ||
return nextFails; | ||
|
||
return endsInDoubleQuote; | ||
} | ||
|
||
const maybeQuote = char => { | ||
if (char === '\'') | ||
return endsInSingleQuote; | ||
if (char === '"') | ||
return endsInDoubleQuote; | ||
|
||
return null; | ||
} | ||
|
||
const stringParser = token(maybeQuote, Syntax.StringLiteral); | ||
export default stringParser; | ||
|