Skip to content
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

Contexts #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Contexts #39

wants to merge 3 commits into from

Conversation

dabbler0
Copy link
Member

Add support for parsing contexts. A parsing context is a prefix, suffix, and indentation level that are added to a block before it reparses, then removed afterward. For instance, the coffeescript when block:

when a
  do b

Has the parsing context with prefix switch\n, no suffix, and an indent of . So before being passed to the parser for reparsing, it becomes:

switch
  when a
    do b

Then after parsing, the parser wrapper layer looks for the block at the correct location in the result, clips it out, and returns that, to give a block that reads with the original text..

@@ -916,15 +936,15 @@ define ['droplet-helper', 'droplet-model', 'droplet-parser', 'coffee-script'], (
if n < 0 or n >= lines.length
return false
# Refuse to add another empty backtick line if there is one already
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/backtick/underscore/

@davidbau
Copy link
Member

It's odd that this merge would leave us in a state when switch cases can be dragged around, but then they can be dragged out to regular statement context where they're illegal.

What would it take to:

(1) Configure an enumeration of parsing contexts on the side and
(2) Tackle droppability rules at the same time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants