Skip to content

Commit

Permalink
Add support to 4D language (#4767)
Browse files Browse the repository at this point in the history
* add .4dm extensons

* no language for the moment

* change the source of syntax highlighting for Agda (#4768)

* Add interpreters 'csh' and 'tcsh' for language 'Tcsh' (#4760)

* Update languages.yml

* Create regtest_nmmnest.csh

Source: https://github.com/barlage/WRF-kill/blob/master/tools/regtest_nmmnest.csh

* Register `.bibtex` as a BibTeX file-extension (#4764)

* Register `.dof` as an INI file-extension (#4766)

* Register `.epsi` as a PostScript file-extension (#4763)

* Add common extensions to Motorola 68k Assembly (#4637)

* Add common extensions to Motorola 68k

* Revert ACE mode for m68k assembly

* Add heuristics for Motorola 68K Assembly

* Add SWIG language and `.i` Assembly extension

Co-authored-by: John Gardner <gardnerjohng@gmail.com>

* Add file extension for SnakeMake (#3953)

* Add file extension for SnakeMake

Previously a file name was defined for [SnakeMake[(snakemake-wrappers.readthedocs.io): #1834

Currently, the canonical extension is `smk` (see [this discussion](https://groups.google.com/forum/#!topic/Snakemake/segLE-RlV_s) with the author (@johanneskoester) of SnakeMake, and the [FAQ](http://snakemake.readthedocs.io/en/stable/project_info/faq.html#how-do-i-enable-syntax-highlighting-in-vim-for-snakefiles)).

* Adding two Snakemake (smk) example files

* add .4dm extensons

* no language for the moment

* add lang-4d tmLanguage

* link syntax highliting

* typo

Co-authored-by: Guillaume Brunerie <guillaume.brunerie+github@gmail.com>
Co-authored-by: friedc <52925889+friedc@users.noreply.github.com>
Co-authored-by: John Gardner <gardnerjohng@gmail.com>
Co-authored-by: Iggy Drougge <idrougge@mac.com>
Co-authored-by: Nils Homer <nh13@users.noreply.github.com>
  • Loading branch information
6 people authored and lildude committed Jan 28, 2020
1 parent 857bbfb commit c51a594
Show file tree
Hide file tree
Showing 10 changed files with 379 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@
[submodule "vendor/grammars/json.tmbundle"]
path = vendor/grammars/json.tmbundle
url = https://github.com/textmate/json.tmbundle
[submodule "vendor/grammars/lang-4d"]
path = vendor/grammars/lang-4d
url = https://github.com/ayoubserti/lang-4d
[submodule "vendor/grammars/language-agc"]
path = vendor/grammars/language-agc
url = https://github.com/Alhadis/language-agc
Expand Down
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ vendor/grammars/jflex.tmbundle:
- source.jflex
vendor/grammars/json.tmbundle:
- source.json
vendor/grammars/lang-4d:
- source.4dm
vendor/grammars/language-agc:
- source.agc
vendor/grammars/language-apl:
Expand Down
7 changes: 7 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
tm_scope: source.bsl
ace_mode: text
language_id: 0
4D:
type: programming
extensions:
- ".4dm"
tm_scope: source.4dm
ace_mode: text
language_id: 577529595
ABAP:
type: programming
color: "#E8274B"
Expand Down
12 changes: 12 additions & 0 deletions samples/4D/generate_project.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//%attributes = {}
$params:=New object:C1471
$params.PRODUCT_NAME:="strophe"
$params.PRODUCT_VERSION:="1.0"
$params.AUTHOR:="miyako"
$params.CREATE_DATE:=Current date:C33
$params.COPYRIGHT_YEAR:=Year of:C25(Current date:C33)

generate_project_source ($params)
generate_project_vs ($params)
generate_project_xcode ($params)
generate_project_plugin_stub ($params)
121 changes: 121 additions & 0 deletions samples/4D/play_with_classes.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//%attributes = {}
// ----------------------------------------------------
// Project method : object
// ID[5543995AC5E24988A39E024B39541A8F]
// Created 13-9-2019 by Vincent de Lachaux
// ----------------------------------------------------
// Description:
//
// ----------------------------------------------------
// Declarations
C_OBJECT:C1216($0)
C_TEXT:C284($1)
C_TEXT:C284($2)

C_TEXT:C284($t)
C_OBJECT:C1216($o)
C_COLLECTION:C1488($c)

If (False:C215)
C_OBJECT:C1216(class ;$0)
C_TEXT:C284(class ;$1)
C_TEXT:C284(class ;$2)
End if

// ----------------------------------------------------
If (This:C1470[""]=Null:C1517) // Constructor

If (Count parameters:C259>=1)

$t:=String:C10($1)

If (Count parameters:C259>=2)

// With parameter
$o:=Formula from string:C1601($t+"(\""+String:C10($2)+"\")").call()

Else

$o:=Formula from string:C1601($t).call()

End if

$o.constructor:=Formula:C1597(class ("constructor"))

End if

Else

Case of

//______________________________________________________
: ($1="constructor") // Returns collection of properties and functions

$o:=New object:C1471(\
"properties";New collection:C1472;\
"functions";New collection:C1472;\
"fomulas";New collection:C1472)

$c:=New collection:C1472

For each ($t;This:C1470)

$c.push($t)

End for each

$c:=$c.orderBy(ck ascending:K85:9)

For each ($t;$c)

Case of

//______________________________________________________
: ($t=$1)

//______________________________________________________
: (Value type:C1509(This:C1470[$t])=Is object:K8:27)

//If (JSON Stringify(This[$t])="\"[object Formula]\"")
If (This:C1470[$t].source#Null:C1517)

$o.functions.push($t)
$o.fomulas.push(This:C1470[$t].source)

Else

$o.properties.push($t)

End if

//______________________________________________________
Else

$o.properties.push($t)

//______________________________________________________
End case
End for each

$o.functions:=$o.functions.orderBy(ck ascending:K85:9)
$o.properties:=$o.properties.orderBy(ck ascending:K85:9)

//________________________________________
: (This:C1470=Null:C1517)

ASSERT:C1129(False:C215;"OOPS, this method must be called from a member method")

//______________________________________________________
Else

$o:=This:C1470[$1].call()

//______________________________________________________
End case
End if

// ----------------------------------------------------
// Return
$0:=$o
// ----------------------------------------------------
// End
47 changes: 47 additions & 0 deletions samples/4D/test_webServerStart.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//%attributes = {"preemptive":"capable"}
C_OBJECT:C1216($webObject)
$webObject:=WEB server:C1674(2) //host db webServer

//some initiatialisation
clear_files


C_OBJECT:C1216($settings)
C_OBJECT:C1216($result)
C_OBJECT:C1216($path;$newIndex)
C_TEXT:C284($response)
$settings:=New object:C1471
$settings.rootFolder:=Folder:C1567(fk web root folder:K87:15).parent.folder("WebFolder2").platformPath
$settings.certificateFolder:=Folder:C1567(fk database folder:K87:14).folder("certificate").platformPath
$settings.HTTPEnabled:=True:C214
$settings.HTTPPort:=8888
$settings.HTTPSEnabled:=True:C214
$settings.HTTPSPort:=4443
$settings.defaultHomepage:="index2.html"

$result:=$webObject.start($settings)

ASSERT:C1129($result#Null:C1517;"result should not be null")
ASSERT:C1129($result.success=True:C214;"result must contain a 'success' attribute and must be true")
ASSERT:C1129($webObject.isRunning=True:C214;"web server 'isRunning' should be true")

//test HTTP
$statusCode:=HTTP Get:C1157("http://localhost:8888";$response)

ASSERT:C1129($statusCode=200;"Web Server not started")

$path:=Folder:C1567($settings.rootFolder;fk platform path:K87:2).file("index2.html")
$newIndex:=File:C1566($path.platformPath;fk platform path:K87:2)

ASSERT:C1129($response=$newIndex.getText();"unexpected index page content")


$statusCode:=HTTP Get:C1157("https://localhost:4443";$response)

ASSERT:C1129($statusCode=200;"Web Server not started")

$webObject.stop()




158 changes: 158 additions & 0 deletions samples/4D/webArea.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
//%attributes = {"invisible":true}
// ----------------------------------------------------
// Project method : webArea
// ID[400C94A87A6E4C049664710A5F9E71F9]
// Created 10-1-2020 by Vincent de Lachaux
// ----------------------------------------------------
// Description:
//
// ----------------------------------------------------
// Declarations
C_OBJECT:C1216($0)
C_TEXT:C284($1)
C_OBJECT:C1216($2)

C_TEXT:C284($t)
C_OBJECT:C1216($o)

If (False:C215)
C_OBJECT:C1216(webArea ;$0)
C_TEXT:C284(webArea ;$1)
C_OBJECT:C1216(webArea ;$2)
End if

// ----------------------------------------------------
If (This:C1470[""]=Null:C1517) // Constructor

If (Count parameters:C259>=1)

$t:=String:C10($1)

End if

$o:=New object:C1471(\
"";"webArea";\
"name";$t;\
"url";"";\
"coordinates";Null:C1517;\
"windowCoordinates";Null:C1517;\
"getCoordinates";Formula:C1597(widget ("getCoordinates"));\
"hide";Formula:C1597(OBJECT SET VISIBLE:C603(*;This:C1470.name;False:C215));\
"moveHorizontally";Formula:C1597(widget ("setCoordinates";New object:C1471("left";$1)));\
"moveVertically";Formula:C1597(widget ("setCoordinates";New object:C1471("top";$1)));\
"resizeHorizontally";Formula:C1597(widget ("setCoordinates";New object:C1471("right";$1)));\
"resizeVertically";Formula:C1597(widget ("setCoordinates";New object:C1471("bottom";$1)));\
"setVisible";Formula:C1597(OBJECT SET VISIBLE:C603(*;This:C1470.name;Bool:C1537($1)));\
"show";Formula:C1597(OBJECT SET VISIBLE:C603(*;This:C1470.name;True:C214));\
"visible";Formula:C1597(OBJECT Get visible:C1075(*;This:C1470.name));\
"back";Formula:C1597(WA OPEN BACK URL:C1021(*;This:C1470.name));\
"content";Formula:C1597(WA Get page content:C1038(*;This:C1470.name));\
"forward";Formula:C1597(WA OPEN FORWARD URL:C1022(*;This:C1470.name));\
"init";Formula:C1597(webArea ("init"));\
"isLoaded";Formula:C1597(WA Get current URL:C1025(*;This:C1470.name)=This:C1470.url);\
"lastFiltered";Formula:C1597(WA Get last filtered URL:C1035(*;This:C1470.name));\
"openURL";Formula:C1597(webArea ("openURL";New object:C1471("url";$1)));\
"refresh";Formula:C1597(webArea ("openURL";New object:C1471("url";$1)));\
"setContent";Formula:C1597(webArea ("setContent";New object:C1471("content";String:C10($1);"base";$2)));\
"title";Formula:C1597(WA Get page title:C1036(*;This:C1470.name))\
)

If (Is Windows:C1573)

$o.openURL() // previously load about:blank

End if

Else

$o:=This:C1470

Case of

//______________________________________________________
: ($o=Null:C1517)

ASSERT:C1129(False:C215;"OOPS, this method must be called from a member method")

//______________________________________________________
: ($1="init")

ARRAY TEXT:C222($tTxt_filters;0x0000)
ARRAY BOOLEAN:C223($tBoo_allow;0x0000)

// All are forbidden
APPEND TO ARRAY:C911($tTxt_filters;"*") // All
APPEND TO ARRAY:C911($tBoo_allow;False:C215) // Forbidden

// Allow WA SET PAGE CONTENT
APPEND TO ARRAY:C911($tTxt_filters;"file*")
APPEND TO ARRAY:C911($tBoo_allow;True:C214) // to allow including HTML files

WA SET URL FILTERS:C1030(*;$o.name;$tTxt_filters;$tBoo_allow)

WA SET PREFERENCE:C1041(*;$o.name;WA enable Java applets:K62:3;False:C215)
WA SET PREFERENCE:C1041(*;$o.name;WA enable JavaScript:K62:4;True:C214)
WA SET PREFERENCE:C1041(*;$o.name;WA enable plugins:K62:5;False:C215) //

// Active the contextual menu in debug mode
WA SET PREFERENCE:C1041(*;$o.name;WA enable contextual menu:K62:6;Not:C34(Is compiled mode:C492) | (Structure file:C489=Structure file:C489(*)))
WA SET PREFERENCE:C1041(*;$o.name;WA enable Web inspector:K62:7;True:C214)

//______________________________________________________
: ($1="openURL")

If (Value type:C1509($2.url)=Is object:K8:27) // File

$t:="file:///"+$2.url.path

Else

$t:=String:C10($2.url)

End if

Case of

//……………………………………………………………………………………………………
: (Length:C16($t)=0)

$t:="about:blank"

//……………………………………………………………………………………………………
: ($t="internal") // Current database server

$t:="127.0.0.1:"+String:C10(WEB Get server info:C1531.options.webPortID)

//……………………………………………………………………………………………………
: ($t="localhost")\
& Is macOS:C1572 //#TURN_AROUND - In some cases, using "localhost" we get the error -30 "Server unreachable"

$t:="127.0.0.1"

//……………………………………………………………………………………………………
End case

$o.url:=$t

WA OPEN URL:C1020(*;$o.name;$o.url)

//______________________________________________________
: ($1="setContent")

WA SET PAGE CONTENT:C1037(*;$o.name;$2.content;Choose:C955($2.base=Null:C1517;"/";String:C10($2.base)))

//______________________________________________________
Else

ASSERT:C1129(False:C215;"Unknown entry point: \""+$1+"\"")

//______________________________________________________
End case
End if

// ----------------------------------------------------
// Return
$0:=$o

// ----------------------------------------------------
// End
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting

<!-- Everything below this line is auto-generated by script/list-grammars. Manual edits will be lost -->
- **1C Enterprise:** [xDrivenDevelopment/atom-language-1c-bsl](https://github.com/xDrivenDevelopment/atom-language-1c-bsl)
- **4D:** [ayoubserti/lang-4d](https://github.com/ayoubserti/lang-4d)
- **ABAP:** [pvl/abap.tmbundle](https://github.com/pvl/abap.tmbundle)
- **ABNF:** [Alhadis/language-grammars](https://github.com/Alhadis/language-grammars)
- **AGS Script:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/lang-4d
Submodule lang-4d added at d2b055
Loading

0 comments on commit c51a594

Please sign in to comment.