question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add comma as a way to list statements

See original GitHub issue

All 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:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
czerwinskilukasz1commented, Oct 5, 2020

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).

0reactions
hunarjain09commented, Dec 4, 2020

Hello @khushboo97 you can use the playground https://cli.askql.org/

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found