Skip to content

Commit

Permalink
Merge pull request #2 from u2berggeist/function_experiment
Browse files Browse the repository at this point in the history
Function Highlighting + Various random improvements
  • Loading branch information
jrwrigh authored Jun 27, 2018
2 parents 7cfff9f + fd09bd3 commit a59ba77
Show file tree
Hide file tree
Showing 12 changed files with 1,097 additions and 50 deletions.
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Lanuch Extension",
"type": "extensionHost",
"request": "launch",
"name": "Lanuch Extension",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}\\test_files\\ImpellerStateFile.ccl"
]
}
]
Expand Down
4 changes: 3 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
vsc-extension-quickstart.md
vsc-extension-quickstart.md
test_files
*.vsix
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# Change Log
All notable changes to the "ANSYS CFX Command Lanugauge (CCL)" extension will be documented in this file.
All notable changes to the "ANSYS CFX Command Language (CCL)" extension will be documented in this file.

Format here based on [Keep a Changelog](http://keepachangelog.com/).

## 1.1.0
### Added
- Function highlighting is now fully enabled!
- Expressions are scoped
- Section headers and contents are now scoped
- Program Constants are defined and scoped

### Changed
- Continued typo fixing

### Removed
- `=` is no longer a math operator. It is treated separately

## 1.0.2
- `=` is now a math operator
- Officially on the MarketPlace now
Expand Down
8 changes: 8 additions & 0 deletions CONTRIBUTE INFO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Here's a section of information for contributing to the extension. This is probably just going to be notes to myself.

## TODO
- [ ] Figure out the function.operator inside function.math issue
- [ ] Set an Expressions theme to highlite alphanumerics (assumed to be user defined expressions)
- [ ] Add numeric section (check to see if there are math operators, then highlite numbers)
- [ ] Look up "citern" and add similar constants to a new selection. Probably keep with constants
- [ ] Make Selections of the options be able to cross lines
- [ ] Make expressions in Flow section be correct


## Helpful Links
- VS Code Language Extension Documentation:
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# ANSYS CFX Command Language (CCL):
### Language support for ANSYS CFX state languages, CCL and CEL.

This is a extension meant to help with syntax highlighting and code folding for script languages involving ANSYS CFX workflows. CFX is a Computational Fluid Dynamics (CFD) software package within the Computer Aided Engineering (CAE) package ANSYS. This extensions is specifically designed to be used with .ccl and .cst files which are the pre- and post-processing scripts within the program.

![Visual Studio Marketplace](https://vsmarketplacebadge.apphb.com/version/u2berggeist.cfxlanguage.svg
)

## Features

- Syntax highlighting
- Includes specific highlighting for CCL built-in functions and constants
- Includes specific highlighting for CCL and CEL native functions and constants
- Code folding
- Supported file extensions: `.ccl` and `.cst`

![screenshot](images/ImpellerStateFile_Screencap.PNG)

## Please report bugs or feature requests on [GitHub](https://www.github.com/u2berggeist/ANSYS_CFX).

## Release Notes
## Want to Contribute? Go [here](https://github.com/u2berggeist/ANSYS_CFX/blob/master/CONTRIBUTE%20INFO.md) to find some helpful resources!

### 1.0.2
Minor Spelling, `=` now added as an math operator, now officially on the Extension Marketplace

### 1.0.1
CHANGELOG added, minor spelling

### 1.0.0
Initial release, basic syntax highlighting

Binary file removed cfxlanguage-1.0.2.vsix
Binary file not shown.
Binary file added cfxlanguage-1.1.0.vsix
Binary file not shown.
Binary file added images/ImpellerCCL_Screencap-DomainandBC.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ImpellerStateFile_Screencap.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cfxlanguage",
"displayName": "ANSYS CFX Command Language (CCL)",
"description": "Language Support for ANSYS CFX based scripts (CFX Command Language, CFX Expression Language, etc.). Applies for pre- and post-processing of CFX simulations.",
"version": "1.0.2",
"version": "1.1.0",
"publisher": "u2berggeist",
"engines": {
"vscode": "^0.19.0"
Expand Down
249 changes: 215 additions & 34 deletions syntaxes/ccl.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,108 @@
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "ANSYS CCL",
"patterns": [
{
"include": "#comment"
},
{
"include": "#functions_math"
},
{
"include": "#functions_operators"
},
{
"include": "#physical_constants"
},
{
"include": "#units"
},
{
"include": "#section_headings"
},
{
"include": "#option"
}
{"include": "#flow"},
{"include": "#comment"},
{"include": "#options"},
{"include": "#functions_math"},
{"include": "#functions_operators"},
{"include": "#physical_constants"},
{"include": "#units"},
{"include": "#section_headings"}
],
"repository": {
"functions_math": {
"patterns": [
{
"name": "support.function.math.ccl",
"match": "[^A-Za-z0-9](abs|sin|cos|asin|acos|tan|atan|if|atans2|besselJ|besselY|cosh|exp|int|loge|log10|min|max|mod|nint|sinh|sqrt|step|tanh|=)[^A-Za-z0-9]"
"name": "meta",
"match": "\\W(abs|sin|cos|asin|acos|tan|atan|if|atans2|besselJ|besselY|cosh|exp|int|loge|log10|min|max|mod|nint|sinh|sqrt|step|tanh)(\\()",
"captures": {
"1": {
"patterns": [
{
"name":"support.function.math.ccl",
"match": ".*"
}
]
}
}
}
]
},
"functions_operators": {
"patterns": [
{
"name": "support.function.operator.ccl",
"match": "\\b(area|area_x|area_y|area_z|areaAve|areaAve_x|areaAve_y|areaAve_z|areaInt|areaInt_x|areaInt_y|areaInt_z|ave|count|countTrue|force|forceNorm|force_x|force_y|force_z|inside|length|lengthAve|lengthInt|mass|massAve|masssFlow|massFlowAve|massFlowAveAbs|massFlowInt|massInt|maxVal|minVal|probe|rbstate|rmsAve|sum|torque|torque_x|torque_y|torque_z|volume|volumeAve|volumeInt|probe)\\("
"name": "meta",
"contentName": "variable.parameter",
"begin": "\\W(area|area_x|area_y|area_z|areaAve|areaAve_x|areaAve_y|areaAve_z|areaInt|areaInt_x|areaInt_y|areaInt_z|ave|count|countTrue|force|forceNorm|force_x|force_y|force_z|inside|length|lengthAve|lengthInt|mass|massAve|massFlow|massFlowAve|massFlowAveAbs|massFlowInt|massInt|maxVal|minVal|probe|rbstate|rmsAve|sum|torque|torque_x|torque_y|torque_z|volume|volumeAve|volumeInt|probe)(\\()",
"end": "\\)@([\\w\\s]+)",
"comment": "begin captures the built-in function name, end captures the @location, and the contentName is the variable parameter of the function",
"beginCaptures": {
"1":{
"patterns": [
{
"name": "support.function.operator.ccl",
"match": ".*",
"comment": "Captures the built-in function name"
}
]
}
},
"endCaptures": {
"1": {
"patterns": [
{
"name":"constant.other",
"match": ".*",
"comment": "The location the function is evaluated at."
}
]
}
}
}
]
},
"functions_all": {
"patterns": [
{"include": "#functions_operators"},
{"include": "#functions_math"},
{"include": "#physical_constants"},
{"include": "#program_constants"}
]
},
"physical_constants": {
"patterns": [
{
"name": "constant.other",
"match": "\\b(avogadro|boltzmann|clight|e|echarge|spspermo|g|mupermo|pi|plank|stegan)\\b"
"name": "meta",
"match": "\\W(avogadro|boltzmann|clight|e|echarge|spspermo|g|mupermo|pi|plank|stegan)\\W",
"captures": {
"1": {
"patterns": [
{
"name":"constant.language.ccl",
"match": ".*"
}
]
}
}
}
]
},
"program_constants": {
"patterns": [
{
"name": "meta",
"match": "\\W(citern|acplgstep|aitern|atstep|cstagger|ctstep|sstep|dtstep|t)\\W",
"captures": {
"1": {
"patterns": [
{
"name":"constant.language.ccl",
"match": ".*"
}
]
}
}
}
]
},
Expand All @@ -60,24 +118,147 @@
"units": {
"patterns": [
{
"name": "keyword.other.unit.ccl",
"match": "\\[.+?\\]"
"name": "meta.unit.ccl",
"match": "(\\[.+?\\])",
"captures": {
"1":{
"patterns": [
{
"name":"keyword.other.unit.ccl",
"match": ".*"
}
]
}
}
}
]
},
"section_headings": {
"patterns": [
{
"name": "keyword.control",
"match": "^\\s*[A-Z ]+\\:"
"name": "meta",
"match": "^\\s*([A-Z ]+)\\:( [\\w ]*)?",
"captures": {
"1":{
"patterns": [
{
"name": "entity.name.class.ccl",
"match": ".*"
}
]
},
"2": {
"patterns": [
{
"name": "constant.other",
"match": "[\\w ]+"
}
]
}
}
}
]
},
"expressions":{
"patterns": [
{"include": "#functions_all"},
{
"name":"meta",
"match": "\\A [^A-Za-z].*",
"captures": {
"0": {
"patterns": [
{"include": "#units"},
{"include": "#numbers"}
]
}
}
},
{"include": "#units"},
{
"name": "storage.modifier.ccl",
"match": "[\\w ]",
"comment": "Capture everything except the comma separator "
}
]
},
"options": {
"patterns": [
{
"name":"meta.options.ccl",
"match": "^\\s*([\\w ]+) =(.*)$",
"captures": {
"1":{
"patterns": [
{
"name": "storage.type.ccl",
"match": ".*"
}
]
},
"2":{
"patterns": [
{"include": "#functions_all"},
{
"name":"meta",
"match": "\\A [^A-Za-z].*",
"captures": {
"0": {
"patterns": [
{"include": "#units"},
{"include": "#numbers"}
]
}
}
},
{"include": "#units"},
{
"name": "storage.modifier.ccl",
"match": "[\\w ]",
"comment": "Capture everything except the comma separator "
}
]
}
}
}
]
},
"flow": {
"patterns": [
{
"name": "meta.section.ccl",
"begin": "^FLOW\\:",
"end": "^END",
"beginCaptures": {
"0":{
"patterns": [
{"include": "#section_headings"}
]
}
},
"patterns": [
{"include": "#section_headings"},
{"include": "#options"},
{"include": "#expressions"}
]
}
]
},
"option": {
"numbers": {
"patterns": [
{
"name":"constant.language",
"match": "^\\s+Option"
"name": "meta.ccl",
"match": "([\\d\\.]+)",
"captures": {
"1": {
"patterns": [
{
"name": "constant.numeric.ccl",
"match": ".*"
}
]
}
}
}
]
}
Expand Down
Loading

0 comments on commit a59ba77

Please sign in to comment.