• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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...
 
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