A stylesheet language written in TypeScript that compiles to CSS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

application.ts 653B

123456789101112131415161718192021
  1. import * as AST from '../ast';
  2. import Env, { EnvError } from '../env';
  3. export class Application {
  4. public name: AST.Literal;
  5. public arguments: AST.Node[];
  6. public constructor(name: AST.Literal, args: AST.Node[]) {
  7. this.name = name;
  8. this.arguments = args;
  9. }
  10. public compile(env: Env, opts: AST.Opts): string | EnvError {
  11. const wordSpacer = opts.prettyPrint ? ' ' : '';
  12. const [lParen, rParen, comma] = ['(', ')', ','];
  13. const compiledArguments = this.arguments
  14. .map((arg) => arg.compile(env, opts))
  15. .join(`${comma}${wordSpacer}`);
  16. return `${this.name.value.value}${lParen}${compiledArguments}${rParen}`;
  17. }
  18. }