• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Lua tags please : )

Status
Not open for further replies.
Before we get Lua tags, can we at least get highlighting for the following natives:

JASS:
native GetPlayerUnitTypeCount takes player p, integer unitid returns integer
native GetUnitGoldCost takes integer unitid returns integer
native GetUnitWoodCost takes integer unitid returns integer
native GetUnitBuildTime takes integer unitid returns integer

native CreepsOnMap takes nothing returns boolean
native UnitAlive takes unit id returns boolean

^^
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I was bored.

highlight.js contains a pretty straightforward function that adds <span> tags to requested keywords, numbers and strings according to the given parameters.

highlighText.js is a WebWorker that calls highlight() with the needed parameters for Jass files (I tried doing it on the main thread, but that makes browser get annoyed at the code).

jass.js has all of the data from common.j and Blizzard.j in JavaScript arrays, it was generated with jass.rb (Ruby).

test.js just creates the highlightText worker and allows the HTML file to send him your Jass code.

Now you can add whatever languages you want by following the example of highlightText.js.

Not too hard :/

The styling is done using CSS, of course, so Google is your friend if you want another style.

Oh and here's a test page.

Edit: I originally forgot about comments, and since they make parsing harder, I instead went to the more sane solution and used CSS selectors, so CSS is now not inline anymore (CSS was meant to be external in the first place anyway).

I most likely forgot some keywords and types, didn't touch Jass in years.
 

Attachments

  • syntax highlighter.7z
    78.2 KB · Views: 51
Last edited:
Level 19
Joined
Oct 15, 2008
Messages
3,231
Ralle, stop working on H2.0 and make the trigger tags recognize Sc2 Triggers. And make a Galaxy parser.

What's the use of a Lua parser anyway?

This, please Ralle:)

Oh and the Lua tags would be useful as well, some of my friends are more comfortable with it, hehe...
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
So any word on these natives?

JASS:
native GetPlayerUnitTypeCount takes player p, integer unitid returns integer
native GetUnitGoldCost takes integer unitid returns integer
native GetUnitWoodCost takes integer unitid returns integer
native GetUnitBuildTime takes integer unitid returns integer

native CreepsOnMap takes nothing returns boolean
native UnitAlive takes unit id returns boolean

And Lua tags?

[lua]
local message = "hello" .. " " .. "world"
[/lua]
 
Status
Not open for further replies.
Top