summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/cxfa_fmlexer.cpp
AgeCommit message (Collapse)Author
2017-07-25Clean up data passing in FormCalc Lexerchromium/3167Ryan Harrison
This CL removes the pattern used in the lexer of passing the lexing member variables around as args to methods. Instead it uses the fact that they are member variables in the methods. This CL also includes renaming of variable and function names to remove unneeded details or make them more precise. BUG=pdfium:814 Change-Id: Id4c592338db9ff462835314252d39ab3b4b2b2ab Reviewed-on: https://pdfium-review.googlesource.com/8850 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-24Rename FMLexer methods to be more descriptiveRyan Harrison
The existing methods had either very bare passive or in some cases misleading names, so this CL changes them active names that describe what they do. This also extracts the IsKeyword method into a helper function since it is actually static. BUG=pdfium:816 Change-Id: I47a113bc9ea8d88a77822a4441266ec56e6b4cbc Reviewed-on: https://pdfium-review.googlesource.com/8730 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-24Remove extracting characters from inputRyan Harrison
Throughout the lexer there is use of a pattern where a character is extracted from the location currently being pointed at in the input and tests are done on this value. This is uneeded, since normally the pointer isn't being modified while the character is stored, so the pointer can be dereferenced directly. This CL also cleans ups the implementation of string extraction from the input to be easier to read, since it did depend on the character being extracted to work. The IsFooCharacter methods are also changed to take in a character instead of a pointer, since they are only testing the character value not the pointer. BUG=pdfium:814 Change-Id: I8eda01e0af59ff1f6c6e97d6fb504856c7a08a24 Reviewed-on: https://pdfium-review.googlesource.com/8690 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-19Rename StringCs c_str() to unterminated_c_str().Tom Sepez
Since there is no guarantee of termination if the StringC was extracted from a snippet of another string. Make it more obvious that things like strlen(str.unterminated_c_str()) might be a bad idea. Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2 Reviewed-on: https://pdfium-review.googlesource.com/8170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-07-18Correct lexer handling of FormCalc identifiersRyan Harrison
This makes the lexer stricter on valid characters for identifiers, and conform to the grammar in the FormCalc spec. This should remove a class of inputs that ClusterFuzz is attempting that are breaking later stages of the transpile. BUG: chromium:736234, pdfium:783, pdfium:784 Change-Id: I3987d6778a82b71d768fa751035993c0af2577ee Reviewed-on: https://pdfium-review.googlesource.com/8010 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-04Removed hand rolled bsearch from IsKeyword methodRyan Harrison
BUG=pdfium:786 Change-Id: I7a852566cdde301ee896c12d9d29043047c31ad4 Reviewed-on: https://pdfium-review.googlesource.com/7211 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-18Use UnownedPtr to check CFX_*StringC lifetimeschromium/3104Tom Sepez
Change interform to avoid temp StringC with dangling ptr. Change-Id: I8d8659973bcdf2cdbcaa6efa6012e4acce5f1604 Reviewed-on: https://pdfium-review.googlesource.com/5571 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-18Remove CXFA_FMErrorInfodan sinclair
This Cl removes the CXFA_FMErrorInfo class. The message was never output, just used as a flag to determine if there was an error. The class has been replaced with a boolean. Change-Id: I1cde99ce6957f5f8c6be0755a198d80ec8378b3a Reviewed-on: https://pdfium-review.googlesource.com/5653 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-17Rename formcalc files to better match contentsDan Sinclair
Most files match the contents. The expression files are named to match their base type even though they contain all the expression subclasses. Change-Id: I3b7705c7b206a9fa1afae8b677f765e8b788e84d Reviewed-on: https://pdfium-review.googlesource.com/5492 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>