Add comma as a way to list statements
See original GitHub issueAll these cause syntax errors:
Example 1
ask { 1, 2 }
// returns 2
Example 2
ask {
1, 2
}
// returns 2
Example 3
for(let i = 0; i < arr:size; i = i + 1, sum = sum + arr:at(i)) { }
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Commas in Lists - Grammar Monster
Commas are used to separate list items. With two list items, don't use a comma. With three list items, use a comma between...
Read more >The Listing Comma - University of Sussex
The listing comma is used as a kind of substitute for the word and, or sometimes for or. It occurs in two slightly...
Read more >Do I need to use a comma with list items? - The Grammar Guide
Listing commas can separate lists of nouns, verbs, adjectives, dependent clauses, or even complete sentences. This can mean that you can have a...
Read more >Using Commas in a List: Rules & Examples | How ... - Study.com
1. Use a comma to separate three or more items on a list. · 2. Use a comma to separate two coordinate or...
Read more >Extended Rules for Using Commas - Purdue OWL
6. Use commas to separate two or more coordinate adjectives that describe the same noun. Be sure never to add an extra comma...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello @hunarjain , I am very happy you volunteer to do this task - it would be a useful syntax structure. You will need to edit a grammar file (https://github.com/xFAANG/askql/blob/master/src/askscript/parser/askscript.grammar.pegjs) to: step 1) make pegjs accept expression with a comma-separated list of statements. I would try adding a new definition to nonArithmNoMethodsExpression . Please read more about PegJS if needed from their site: https://pegjs.org/
step 2) write appropriate code in https://github.com/xFAANG/askql/blob/master/src/askscript/parser/askscript.grammar.pegjs.classes.ts, which will handle this and translate to mhagmajer’s structures - please consult with him what’s the most convenient way. Likely you will produce a code block for the comma-separated list of statements (and the last one will be treated as a return value for the whole block just out-of-the-box).
Hello @khushboo97 you can use the playground https://cli.askql.org/