Message from JavaScript discussions
November 2017
— I never knew there was not an official spec
And I just realized... I could just do a split by \n
and then
var rowString = "[" + csvRow + "]";
var rowArray = JSON.parse(rowString);
— Https://gist.github.com/Floofies/8d83b0375afb39ab4a1848f5455039c8
— Now the LR(1) parser... Uses that function internally, and then does some extra steps... It rips out the whole first row (the column head) and the first element of each row (row head)
— Heh, there really isn't, it's madness
— Also, excel parses equations if they start with = in csvs
— In the parse table, there will not be letters in the column head, only numbers
— They equate to the UTF-16 decimal of characters
— That way I don't have to worry about "\n" being parsed weird, among others
— Floofies ... Bro... Would be a pleasure if I could actually understand how that parser works... I am sire it would help me knowledge wise ... A lot... Maybe even join you
— Well that particular one is a very basic LR(1) parser. LR means "Left-to-right Rightmost-derivation", and the 1 indicates it has 1 symbol of lookahead.
— It will add symbols to the stack before knowing what to do with them, and usually makes the decision of what to do with them when the lookahead symbol indicates it. As soon as the lookahead symbol has a reduction entry in the parse table (or in this case, a plain conditional) it then does something with some or all of the symbols in the stack, immediately to the left of the lookahead symbol. It can prune the stack as a result as well