Allow creation and modification of scopes in GN.

Previously scope variables could only be created by exec_script() and read_file() functions. This patch adds the following syntax:
  foo = { a = 1 b = 2 }
  foo.a += 1
  foo.c = 3
This will be used in a followup for toolchain args for non-default toolchains, which will allow us to generalize the templates as the number of configurations grows over time (currently every variable has be to be forwarded in the root toolchain templates).

It also allows mutations of list elements which isn't actually necessary for this but the implementation is the same as for scope mutations:
  list[0] = "foo"

This does a significant rework of the operator implementation. This was required for the more general "destination" for assignments and mutations.

It also updates the operator functions to use move semantics more. Previously:
  list3 = list1 + list2
Would be implemented as:
  1. Copy list1 into new new variable.
  2. Copy list2 into a new variable.
  3. Copy list1's copy to a new variable.
  4. Append elements of list2 to list1's copy by copying.
  5. Copy that list to list3.
That's a lot of copies! The new implementation does:
  1. Copy list1 into a new variable.
  2. Copy list2 into a new variable.
  3. Append elements of list2's copy to list1's copy by moving.
  4. Move list2 to list3.
Assuming the lists contain strings, each string should now be copied exactly once rather than three times.

Added a lot of documentation to the grammar help on how the language works (not strictly grammar but it seems like the best place to put it.

BUG=

Review-Url: https://codereview.chromium.org/2187523003
Cr-Original-Commit-Position: refs/heads/master@{#409672}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 01cdea1ed9ad32a7a595ef1a5adfa384006e3097
20 files changed
tree: ba7c951c1178c7c93a42bcafdd494fca5641f579
  1. tools/