Created
October 15, 2018 18:51
-
-
Save backupbrain/e710544fe857870e59956e49e60ee638 to your computer and use it in GitHub Desktop.
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
Tokenizer.prototype.padTokens = function(text) { | |
tokenized = text.replace(/ ?([,\(\)\/\[\]\+\*\-]+) ?/g, " $1 "); | |
tokenized = tokenized.replace(/ ?([,]) ?/g, " $1 "); | |
tokenized = tokenized.replace(/- >/g, "->") | |
tokenized = tokenized.replace(/ ?(==) ?/g, " $1 "); | |
tokenized = tokenized.replace(/;/g, " ;"); | |
tokenized = tokenized.replace(/\s{2,}/g, " "); | |
return tokenized; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment