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

Rework of SDC syntax definition for Issue #4 EOL Comments #5

Merged
merged 6 commits into from
Jul 8, 2019

Conversation

Remillard
Copy link
Contributor

  1. Added *.sublime-project to the .gitignore because I tend to keep the project file in the project area.
  2. Removed the original syntax files that were in TextMate format.
  3. After a few false starts, realized that SDC is effectively just Tcl with special commands.
  4. The Tcl syntax definition already scopes command words that aren't part of the base command set, so that takes care of all the actual special commands. I added two contexts for the special SDC switches frequently seen that were in the original syntax file.
  5. Note that I removed the all caps versions of the switches simply because we can put in a (?i) and made the regular expression case-insensitive.
  6. Known issues are due to the Tcl syntax at this point. Due to the way Tcl inconsistently uses {} there are some guesses made by the Tcl syntax as to whether to scope the text inside a {} as a string, or as a command block. Additionally, Tcl does not know all switches to all commands and largely doesn't try to figure it out, so the SDC switches (like -add_delay) will be scoped in SDC mode, however regular Tcl switches will not be scoped. For the most part this doesn't matter unless writing really elaborate SDC files (I tested it with some automatically generated DDR SDC files and it did alright, though you'll start to see some weaknesses in the basic Tcl syntax.)

@Remillard Remillard changed the title Rework of SDC syntax definition Rework of SDC syntax definition for Issue #4 EOL Comments Jul 1, 2019
@leoheck
Copy link
Owner

leoheck commented Jul 3, 2019

Awesome @Remillard, thank you for your PR. I will review it later.

@leoheck
Copy link
Owner

leoheck commented Jul 7, 2019

I am testing it right now, and I saw that words ending with a number are wrong:

image

I don't like this behavior. I don't know if it was caused by your PR I have to verify.

@leoheck
Copy link
Owner

leoheck commented Jul 7, 2019

Something to check.

image

@leoheck
Copy link
Owner

leoheck commented Jul 7, 2019

Ah, just answering your items,

  1. Added *.sublime-project to the .gitignore because I tend to keep the project file in the project area.
  2. Removed the original syntax files that were in TextMate format.

Cool, awesome.

  1. After a few false starts, realized that SDC is effectively just Tcl with special commands.

Yes, it is.

  1. The Tcl syntax definition already scopes command words that aren't part of the base command set, so that takes care of all the actual special commands. I added two contexts for the special SDC switches frequently seen that were in the original syntax file.

Ok.

  1. Note that I removed the all caps versions of the switches simply because we can put in a (?i) and made the regular expression case-insensitive.

Good!

  1. Known issues are due to the Tcl syntax at this point. Due to the way Tcl inconsistently uses {} there are some guesses made by the Tcl syntax as to whether to scope the text inside a {} as a string, or as a command block. Additionally, Tcl does not know all switches to all commands and largely doesn't try to figure it out, so the SDC switches (like -add_delay) will be scoped in SDC mode, however regular Tcl switches will not be scoped. For the most part this doesn't matter unless writing really elaborate SDC files (I tested it with some automatically generated DDR SDC files and it did alright, though you'll start to see some weaknesses in the basic Tcl syntax.)

Ok, I agree with that.

@Remillard
Copy link
Contributor Author

Those are probably in the base TCL syntax. I could try to override it maybe. The problem is that TCL is not really precise when it comes to token names. I'll see what I can do tomorrow.

@leoheck
Copy link
Owner

leoheck commented Jul 8, 2019

Yeah, I agree with you. I am almost about to merge your PR. So, if you can give it a try I will wait until the end of the week. We can also fix these things later.

@Remillard
Copy link
Contributor Author

I've got to do some constraint work this afternoon so it'll be a perfect time to try to figure out if there's anything that can be done about the numeric constant issue.

@Remillard
Copy link
Contributor Author

Okay as for the numeric constants, I think you have something else doing that to you. I see the following (just typing in one of your constraints into my own SDC file)

image

I have a little routine in VHDL mode that is a scope sniffer at the point which is handy for navigating the details. If I put the point at the 18 that colored wrongly for you, I don't see any scope that would indicate numeric constant. So I don't know what to chalk that up to. Additionally in my own constraints I have the following:
image
where I also have some strings that have numbers inside them and they are colored as a string, though that is definitely one of the quirks of the TCL syntax module in Sublime. They say if there is no space between curly brace and the first character like {test text} then it treats it as a string. If there is a space like: { probably_command_word } then it treats it like a list of command words.

So I can't explain your number constant issue.

I can add capacitance and time switches quite easily and will do that.

@Remillard
Copy link
Contributor Author

Okay, with the time and capacitance, it looks like that's covered already: I see the following with your example:
image

@Remillard
Copy link
Contributor Author

The only thing I can think is that you might need to reselect the syntax type? If you have both the old file and the new file around, your SDC file might have selected the original? I know the original had the number issue -- I don't know about the keyword. Make sure it says "Synopsys Design Constraints". I made that the full name instead of just SDC.
image

@leoheck
Copy link
Owner

leoheck commented Jul 8, 2019

Oh, cool, that looks good.

@leoheck leoheck merged commit 005eaec into leoheck:master Jul 8, 2019
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