01: /* -*- mode: Java; c-basic-offset: 2; -*- */
02:
03: /**
04: * LZX Function representation
05: * @author steele@osteele.com
06: */package org.openlaszlo.sc;
07:
08: public class Function {
09: private String name;
10: private final String args;
11: private final String body;
12: private final String sourceLocation;
13:
14: public Function(String body) {
15: this ("", body);
16: }
17:
18: public Function(String args, String body) {
19: this ("", args, body);
20: }
21:
22: public Function(String name, String args, String body) {
23: this (name, args, body, null);
24: }
25:
26: public Function(String name, String args, String body, String loc) {
27: this .name = name;
28: this .args = args;
29: this .body = body;
30: this .sourceLocation = loc;
31: }
32:
33: public void setName(String name) {
34: this .name = name;
35: }
36:
37: public String toString() {
38: return (sourceLocation != null ? (sourceLocation + "\n") : "")
39: + "function " + name + "\n(" + args + "\n) {" + body
40: + "\n}";
41: }
42: }
43:
44: /**
45: * @copyright Copyright 2001-2007 Laszlo Systems, Inc. All Rights
46: * Reserved. Use is subject to license terms.
47: */
|