-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify parsing lines starting with slash #4462
base: master
Are you sure you want to change the base?
Conversation
jenkins build this please |
By the way, since anything after '/' is considered to be a comment (except the line addressed in this commit), double slash '//' is equivalent to '/'. |
jenkins build this please |
I extended the test that checks the parsing of the random slash. The test passes with the change proposed in this PR, and fails without it. The change categorizes a slash followed by any symbols (usually comments) as |
jenkins build this please |
With this PR we will ignore any unexpected line where the first non-whitespace character is a slash. We are quite forgiving here, but one can change that behaviour using the ParseContext. Let's say there should be only one table, then with master
and also this
would work. The last line of the second example is ignored as it is just a slash. Either changing the last line of the second example to a double slash or a slash with a comment would raise an exception with master. With this PR this will not be the case any more and we will still ignore the last line in the second example regardless of any following character. Just to be clear: Even if we expect only one table this will be parsed by Flow with the PR
If we expect more than one table then the last tables will be copies of the first one in the last example with this PR. |
When the file is parsed, anything after '/' is treated as a comment with one exception. When parser expects a keyword but the line contains something else, the function
handleRandomText
(which body was addressed in this commit) is called. If the line contains only a single '/', the response depends on thePARSE_RANDOM_SLASH
variable (throw, warn, or ignore).This is the only place where the text after '/' makes a difference and this commit removes the irregularity.