oftn-oswg / coca

An implementation of C in JavaScript.
Other
10 stars 3 forks source link

Trigraph/digraph sequences are not supported #2

Open dsamarin opened 13 years ago

dsamarin commented 13 years ago

Tokenizer.prototype.nextch should recognize trigraph sequences and instead return the correct replacement.

Before any other processing takes place, each occurrence of one of the following sequences of three characters (called trigraph sequences12)) is replaced with the corresponding single character.

??=  #
??(   [
??/   \
??)   ]
??'   ^
??<   {
??!   |
??>   }
??-   ~

Digraphs are easier to add since the punctuators are constructed automatically as a trie structure and can be added with the add() method of Token.punctuators.