Theme Unit Test

CATEGORIES

ARCHIVES


Example of C++ syntax coloration with line number:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <iostream>:

class Example {
	public:
		static void do_something();
};

void Example::do_something() {
	std::cout << "Well, not really" << std::endl;
}

int main(int argc, char ** argv) {
	Example::do_something();
	return 0;
}

Another example of Python syntax coloration without line number:

def merge(iterable, argv):
    if len(argv) != 2:
        raise PatternMissingArguments(expected=2,got=len(argv))
    try:
        return argv[1].join([argv[0].format(**something) for something in iterable])
        
    except IndexError as e:
        if e.args == ('tuple index out of range',):
            raise PatternInvalidArgument(name="string", value=argv[0])
                
        raise e