Python Forum
testing syntax highlighter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
testing syntax highlighter
#1
Python
[shcode=python]
class Ship:
   def __init__(self, sheet):
       self.frames = strip_from_sheet(sheet, (0,0), (122,164), 4, 4)
       self.frame_index = 0
       self.update()
       
   def update(self):
       self.image = self.frames[self.frame_index]
       
   def get_event(self, event):
       if event.type == pg.KEYDOWN:
           self.frame_index += 1
       
   def draw(self, screen):
       screen.blit(self.image, (0,0))
[/shcode]

XML
[shcode=xml]
<note>
   <to>Tove</to>
   <from>Jani</from>
   <heading>Reminder</heading>
   <body>Don't forget me this weekend!</body>
</note>
[/shcode]

Bash
[shcode=bash]
#!/bin/bash
STRING="Hello World"
echo $STRING
[/shcode]

C++
[shcode=cpp]
#include <tuple>
std::tuple<int, bool, float> foo()
{
    return std::make_tuple(128, true, 1.5f);
}
int main()
{
    std::tuple<int, bool, float> result = foo();
    int value = std::get<0>(result);
    int obj1;
    bool obj2;
    float obj3;
    std::tie(obj1, obj2, obj3) = foo();
}
[/shcode]
Recommended Tutorials:
Reply


Messages In This Thread
testing syntax highlighter - by metulburr - Sep-05-2016, 12:22 AM
RE: testing syntax highlighter - by nilamo - Sep-16-2016, 03:08 PM
RE: testing syntax highlighter - by metulburr - Sep-16-2016, 03:14 PM
RE: testing syntax highlighter - by metulburr - Sep-16-2016, 03:14 PM
RE: testing syntax highlighter - by nilamo - Sep-16-2016, 03:19 PM
RE: testing syntax highlighter - by metulburr - Sep-16-2016, 03:22 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020